UNC path files from UNIX

J

John Smith

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
 
T

Thomas Weidenfeller

John said:
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.
 
P

Phillip Lord

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
 
T

Thomas Weidenfeller

Phillip said:
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 ">".
 
P

Phillip Lord

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
 
R

Rogan Dawes

John said:
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

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

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

Rogan
 
P

Phillip Lord

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
 
W

Wayne

John said:
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

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,266
Messages
2,571,087
Members
48,773
Latest member
Kaybee

Latest Threads

Top