Reputation: 607
I want to upload file from my system to remote server as ftp.how i am to resolve this.I am using FTPClient client = new FTPClient(); and client.connect("sftp://something.com");
But i am unable to connect it how i am check weather problem with my code or url.like ping command
Upvotes: 1
Views: 700
Reputation: 28761
I haven't used FTPClient
(assume you mean Apache Commons FTPClient but a quick browse of apidocs shows two errors in your use:
client.connect("sftp://something.com")
should be client.connect("something.com")
Upvotes: 3
Reputation: 15229
If you're connecting to an Sftp you might need to add the appropriate certificates (public/private keys) to the JVM where the code is running. Try your code on a regular FTP connection first, if that works, but not the sftp connections, it's almost sure is because of that.
Upvotes: 0