Upload ,Download file to and from windows shared drive where java App server is running on unix Upload ,Download file to and from windows shared drive where java App server is running on unix unix unix

Upload ,Download file to and from windows shared drive where java App server is running on unix


You didn't mention what you've tried so far. Just to help out:

Option 1: Mount shared folder "\shared\" on a local directory using SAMBA. You mount "\shared\" to "/mnt/myshared/" and then upload or download file in the path "/mnt/myshared/myfiles" from your java app.(You need to write command to mount the directory via ascript or manually and then run your java app and access the directory like native directory.)

Option 2: Use jCIFS. The jCIFS library can be used to access Windows Shared directories. Its API is similar to the File and FileI/OStream classes in java.io if you prefer a pure java approach.

The above are the most preferred generic solutions. Also do make sure to update /etc/hosts or any specific configuration files, so that the shared directory and the server become accessible from unix.


yes, take a look at CIFS

However the best approach would be to mount windows shared drive to Unix

something like described here

I would go with that way.


While jcifs is good, you actually might find that if you can architecturally mount the Windows drive via samba on the Linux machine and then use simple File I/O ops in Java to read/write to the filesystem, it may work out better.