Access NFS share from Java program

∥☆過路亽.° 提交于 2019-12-10 14:44:16

问题


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/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.


回答1:


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.




回答2:


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




回答3:


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.



来源:https://stackoverflow.com/questions/1864299/access-nfs-share-from-java-program

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!