windows - How to connect to a sub-domain FTP in JAVA -


i trying write java program connect ftp. have downloaded .jar file apache , added lib folder in project.

when try connect ftp per code below, java.net.unknownhostexception

if use

  • ftp:// subdomain.example.com - java.net.unknownhostexception

  • ftp.subdomain.example.com - java.net.unknownhostexception

  • ftp:// example.com - java.net.unknownhostexception

  • ftp.example.com - works!

all files @ ftp:// subdomain.example.com/ , don't want change in ftp.

if try open ftp:// subdomain.example.com/ in google chrome browser, asks username , password.

import java.io.ioexception; import java.net.socketexception;  import org.apache.commons.net.ftp.ftpclient; import org.apache.commons.net.ftp.ftpfile;  public class connecttoftp {  public static final void main(string[] args) throws socketexception, ioexception {       ftpclient ftp = new ftpclient();       try {           ftp.connect("ftp://subdomain.example.com");        } catch (exception e) {           system.out.println("the error : " + e.tostring());         }       system.out.println("login: "+ftp.login("username", "password"));  } } 

can please me in getting connection ftp://subdomain.example.com/

you want use ftp.connect("subdomain.example.com").


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -