unixtomcatfile-uploaddownloadwindows-share

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


In my application I have to Upload,download files to and from windows shared drive where my java App server which is Tomcat server is running on Unix environment. Is there any Java API or any java Open source tools that does my Job?


Solution

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