Search code examples
javaftpfileinputstream

java code to download a file from server


using java code in windows i need to download several files from a directory placed in a server. those files in server are generated separately. so i'll not know the name of those files. is there any way to download it using JAVA and saving it in a specific folder.

i am using apache tomcat.

I read all other threads related to java file download. But none of them satisfy my requirement.


Solution

  • Use java.net.URL and java.net.URLConnection classes.