Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2005

Tip: Looking for answers? Try searching our database.

UNC path files from UNIX

Thread view: 
John Smith - 17 May 2005 09:49 GMT
We have a java application that runs on windows servers and accessing remote
files using a UNC path name. We have been asked to move the application to a
solaris machine. Will the UNC file access work the same we are creating
simple File objects to do this.

Thanks

Jon
Thomas Weidenfeller - 17 May 2005 10:17 GMT
> We have a java application that runs on windows servers and accessing remote
> files using a UNC path name. We have been asked to move the application to a
> solaris machine. Will the UNC file access work the same we are creating
> simple File objects to do this.

No, they are a Microsoftism. Do the remote systems run Windows, or will
they also be moved to Solaris? If they are moved to Solaris, export the
necessary file systems via NFS, mount them on your server, and be done
with it.

If the remote systems stay on Windows, you are in trouble. You either
need to teach Solaris to mount SMB shares (AFAIK there is only one
commercial program offering an SMB file system implementation) [1], or
teach the Windows systems to speak NFS (there are a couple of NFS
implementations for Windows), and then mount the Windows NFS files
systems via NFS.

/Thomas

[1] No, Samba doesn't do it. Samba does it the other way around,
    exporting Unix file systems via SMB, and the cortesty smbfs
    of Samba only works on Linux.

Signature

The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq

Phillip Lord - 17 May 2005 10:49 GMT
>>>>> "Thomas" == Thomas Weidenfeller <nobody@ericsson.invalid> writes:

 Thomas> John Smith wrote:
 >> We have a java application that runs on windows servers and
 >> accessing remote files using a UNC path name. We have been asked
 >> to move the application to a solaris machine. Will the UNC file
 >> access work the same we are creating simple File objects to do
 >> this.

 Thomas> No, they are a Microsoftism. Do the remote systems run
 Thomas> Windows, or will they also be moved to Solaris? If they are
 Thomas> moved to Solaris, export the necessary file systems via NFS,
 Thomas> mount them on your server, and be done with it.

 Thomas> If the remote systems stay on Windows, you are in
 Thomas> trouble. You either need to teach Solaris to mount SMB
 Thomas> shares (AFAIK there is only one commercial program offering
 Thomas> an SMB file system implementation) [1], or teach the Windows
 Thomas> systems to speak NFS (there are a couple of NFS
 Thomas> implementations for Windows), and then mount the Windows NFS
 Thomas> files systems via NFS.

 Thomas> /Thomas

 Thomas> [1] No, Samba doesn't do it. Samba does it the other way
 Thomas> around,
 Thomas>      exporting Unix file systems via SMB, and the cortesty
 Thomas>      smbfs of Samba only works on Linux.

What about the samba client? A much lighter weight solution than using
the actual file system. My experience is that most linuxes these days
use smbclient at access SMB file systems when offered through a GUI
file system explorer.

Phil
Thomas Weidenfeller - 17 May 2005 14:15 GMT
> What about the samba client? A much lighter weight solution than using
> the actual file system. My experience is that most linuxes these days
> use smbclient at access SMB file systems when offered through a GUI
> file system explorer.

It will not really help the OP. The OP wants to access remote files
through Java's normal java.io.File object. smbclient, however, is a
command line tool to copy files. Using smbclient would require to copy
the whole file over, and then access it locally. If the remote file
changes while someone is still using the local copy it gets ugly. If
data should be written to that file it becomes really ugly (copy it
over, change it locally, copy it back).

/Thomas

PS: Consider working on your quoting style. There is no need to quote my
complete message, and there is no need to prefix each line with
something else than a ">".

Signature

The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq

Phillip Lord - 17 May 2005 14:38 GMT
>>>>> "Thomas" == Thomas Weidenfeller <nobody@ericsson.invalid> writes:

 Thomas> Phillip Lord wrote:
 >> What about the samba client? A much lighter weight solution than
 >> using the actual file system. My experience is that most linuxes
 >> these days use smbclient at access SMB file systems when offered
 >> through a GUI file system explorer.

 Thomas> It will not really help the OP. The OP wants to access
 Thomas> remote files through Java's normal java.io.File
 Thomas> object. smbclient, however, is a command line tool to copy
 Thomas> files.

Yes. Worth checking to see whether anyone has providing Java access to
it.

I agree it's unlikely to work directly with java.io.File. But it's at
least a step forward.

 Thomas> If the remote file changes while someone is still using the
 Thomas> local copy it gets ugly. If data should be written to that
 Thomas> file it becomes really ugly (copy it over, change it
 Thomas> locally, copy it back).

Again, something that you would rather not deal with.

 Thomas> /Thomas

 Thomas> PS: Consider working on your quoting style. There is no need
 Thomas> to quote my complete message

No doubt true.

 Thomas> and there is no need to prefix each line with something else
 Thomas> than a ">".

You are, of course, welcome to your opinion.

Phil
Rogan Dawes - 17 May 2005 16:13 GMT
> We have a java application that runs on windows servers and accessing remote
> files using a UNC path name. We have been asked to move the application to a
[quoted text clipped - 4 lines]
>
> Jon

You may be able to get something helpful from the JCIFS project. MS
NETBIOS/CIFS implemented in Java.

http://jcifs.sourceforge.net/ , IIRC

Rogan
Signature

Rogan Dawes

*ALL* messages to discard@dawes.za.net will be dropped, and added
to my blacklist. Please respond to "nntp AT dawes DOT za DOT net"

Phillip Lord - 17 May 2005 17:24 GMT
>>>>> "Rogan" == Rogan Dawes <discard@dawes.za.net> writes:

 Rogan> John Smith wrote:
 >> We have a java application that runs on windows servers and
 >> accessing remote files using a UNC path name. We have been asked
 >> to move the application to a solaris machine. Will the UNC file
 >> access work the same we are creating simple File objects to do
 >> this.  Thanks Jon

 Rogan> You may be able to get something helpful from the JCIFS
 Rogan> project. MS NETBIOS/CIFS implemented in Java.

 Rogan> http://jcifs.sourceforge.net/ , IIRC

jcifs.samba.org I think.

Looks like its works through the URL mechanism, so it won't work with
java.io.File, but it's close enough.

Phil
Wayne - 18 May 2005 18:21 GMT
> We have a java application that runs on windows servers and accessing remote
> files using a UNC path name. We have been asked to move the application to a
[quoted text clipped - 4 lines]
>
> Jon

UNC names look like this:

    \\servername\sharename\path\file

or:    //servername/sharename/path/file

The servername may be a NetBIOS name of the form: domain.host.
This can (usually) be looked up in DNS to get an IP address (or0
real DNS hostname) for the server.  The sharename maps to some
directory on that server.

Given all that you should be able to write some simple
code to convert a UNC name to a URI that can be used with
class File, something like:

    file://server-hostname-or-IP/path-to-share/path/file

Of course you'd have to maintain all the mappings; if they change
on the windows servers you'd have to change them here too.  An
easier way is to install the Samba package and use the client tools
available, with cron, to maintain that stuff in a local file/DB that
your Java application can access to do the translations.

-Wayne


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.