Access NFS share from Java program
I'd like to read some data from an NFS share from my Java program. I'd need the program to authenticate to the NFS server first, then do the I开发者_Python百科/O. (Requiring the NFS share to be previously mounted is not acceptable.)
So, I'd like the functionality that's provided by this library: http://jcifs.samba.org/ , except for NFS instead of CIFS. Is such a thing built into Java already, or do I need a third-party library?
I'm also interested in whether this can be done in Perl, Python, or Ruby. But mostly Java.
I am the author of the NFS client in Java mentioned above. Sorry for such a late reply. I still have a copy lying around even though I am not sure whether it is compatible with Java 1.4+. I can work on it if there is real interest.
There is a library called yaNFS that is a port of webnfs source. I haven't tried it myself, but it looks like it can be something for you http://java.net/projects/yanfs
NFS is almost always implemented in-kernel, but it looks like you may be in luck. I googled for "nfs client library", and found a few, one even in Java.
http://www.jars.com/utilities/libraries/resource.php/12291
edit: that one's old and abandoned. sorry.
If you can make sysadmin style changes during install of your app, you can set up automount. e.g. on my linux systems at home, /net/llama/home/peter is my home directory on llama, but the trick is that it's only mounted when I access the path. This looks like a decent intro to automounting:
http://wiki.archlinux.org/index.php/Autofs It mostly applies to any Linux distro, except for the bits about installing specific packages.
If you want to enable this only for the user of your app, the automount directory could be inside a directory with limited permissions, unlike the usual /net.
精彩评论