Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

accessing an NFS share from java

Tags:

java

nfs

I'm trying to sort out a way to access an NFS share (ideally all privileges, but I'll settle for read only for now) from our application in Java. I've spent most of the day researching and the closest I came was the yanfs project (nee WebNFS) but it doesn't seem to have been updated since the aughties and it doesn't have any documentation either. I ran some low grade experiments with it but those were unsuccessful.

Because of the nature of our application, I can't pre-mount the volumes (there could be zero to many) and I would like to avoid calling sudo mount inside the program if at all possible. Unfortunately this approach is the only semi-viable solution I can come up with. Any suggestions would be welcome.

Also: No modern NFS java client libraries? Really? That can't possibly be right.

like image 326
Kevin Milner Avatar asked Aug 11 '26 19:08

Kevin Milner


1 Answers

Have you checked out this library https://github.com/dCache/nfs4j ?

It has a server and client pure java implementation for NFSv3, NFSv4 and NFS4.1.

It is a bit low level and it does NOT provide simple usage like XFile in yaNFS.

So you have to do a bit of work to read and write to files, But at least it gets the job done, Accessing NFS exports without mounting.

You can find some file access examples at the project repo.

like image 191
demon36 Avatar answered Aug 13 '26 09:08

demon36



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!