Domanda

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?

È stato utile?

Soluzione

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.

Altri suggerimenti

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top