want to download the file using java code from the server which is not SFTP server,how can i do this? i dont have an SFPT server , i use an apache tomcat server ,and copy files to that server. my another application working on different server want to access the file from the first server. how can i do this using java
-
So you want to download files which are deployed to Apache Tomcat from remote server which runs the java code ? – Babl Jan 29 '15 at 17:30
-
Please spend more time formatting your question. Lots of grammar mistakes. You meant SFTP not SFPT, and you didn't capitalize any new sentences. – SpacePrez Jan 29 '15 at 18:00
3 Answers
(S)FTP downloads are only possible from (S)FTP servers. You cannot perfom a FTP download from a server that does not provide that protocol.
But you can use http(s) to download files from your tomcat.
Here is a good explanation: https://stackoverflow.com/a/7632191/4296831
Usually, if it is Linux/unix server then you will have scp demon up and running. May be you can then try downloading file using scp instead of SFTP. Also, there is very good support from JSch library for doing this. Here is an example: http://www.jcraft.com/jsch/examples/ScpFrom.java.html

- 264
- 2
- 8
You can't. Either install an SFTP server (easy to set up, free software) or use a different protocol. You can't request data that isn't being served up, unless you're asking how to hack in which this isn't really the place for.

- 1,086
- 7
- 15