Ftp URL, j2re1.3.1 versus j2re1.4.1

Hello everybody
I have a client application running on a PC, OS win2k, which regularly uses an ftp URL to download data files from a remote FTP server.
There are two options for this, either through an Ethernet LAN or through slow modem connection (19.2kb) via PPP.
When this application runs under j2re1.3.1 everything is fine in any case.
I recently upgraded to j2re1.4.1, but things changed
1) LAN connection everything is OK as usual
2) Modem connection download a file from root directory, everything still OK.
3) Modem connection, download a file from a subdirectory, i receive an exception sun.net.ftp.FTPProtocolException: PORT
the URL i'm using is
ftp://myuserid:mypassword@serverIP/path/filename
i tried
ftp://myuserid:mypassword@serverIP:21/path/filename
but still throwing same exception as above.
What has changed from 1.3.1 to 1.4.1 concerning URLs or security?
Best Regards
Kostas Bouzianas

It would be useful if you posted a stack trace showing the exact FtpProtocolException that is thrown. From your first post it sounds like the PORT command is failing and if so, then the response string from the ftp server should be include in the exception text. The PORT command issued by the 1.4.x ftp client is identical to the PORT command issued by the 1.3.x implementation but in the 1.4 case PORT will only be used if a passive mode connection fails. In other words, in 1.4 the ftp client first tries a EPSV or PASV command to use a passive mode connection. Is there any possibility that this causes a problem on the embedded device so that a subsequent PORT command fails?

Similar Messages

  • Ftp:// URLs do now work in Safari

    I can not get any ftp:// URLs to work in Safari. I sent in a bug report, but am hoping someone has a workaround for this.
    This is the message I get if I try to download GSView from mirror.cs.wisc.edu using Safari:
    Safari can’t open the page.
    Safari can’t open the page “ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/ghostgum/gsv48w32.exe”. The error was: “unknown error” (NSURLErrorDomain:-1) Please choose Report Bugs to Apple from the Safari menu, note the error number, and describe what you did before you saw this message.

    FTP did not work for any of the Ghostscript mirrors that I tried, so I assumed it just did not work at all.
    I confirmed that with a local FTP server that it works somewhat.
    If you specify the full path to the directory you are interested in it gets there, however if you attempt to click down into a directory, it hangs and you get server connection interrupted windows popping up.
    Also once you are there it gets server connection interrupted windows popping up randomly.

  • HttpURLConnection -- getting error 502 passing ftp url  w embedded password

    I am connecting to http proxy server which supports cern ftp.
    I specify the -DftpProxySet command line options to point java to the http proxy.
    I specify a ftp url like following and it works OK:
    ftp://machine.company.com/readme.txt
    it works fine.
    But when I change the ftp server to require password and pass ftp url such as
    ftp://user:[email protected]/readme.txt. , it fails.
    It works OK when I type above password ftp Url manually into the IE browser that is pointing to same http proxy the java is using.
    Error:
    java.io.IOException: Server returned HTTP response code: 502 for URL: ftp://user:[email protected]/readme.txt
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:562) at com.mycompany....Line 300
    Line 300:
    InputStream stream = connection.getInputStream();

    Hi, I have exactly the same problem!
    Could you solve it?
    Regards, Markus

  • I can't open ftp url's in safari

    safari can't open ftp:// url's such as ...
    ftp://www.apcmedia.com:21/salestools/STRH-6D5PA3R0EN.pdf
    i've tried with and without "use passive ftp mode" in network settings / proxies. i always get ...
    Safari can’t open the page “ftp://www.apcmedia.com:21/salestools/STRH-6D5PA3R0EN.pdf” because it could not load any data from this location.
    I have to use IE in vpc then transfer the pdf back to mac os x. what a pain !
    Mitch

    Hi Mitch,
    The download doesn't work for me either. I'm not sure what the problem is but send feedback to the Safari team via Safari menu -> Report Bugs to Apple...
    I have to use IE in vpc then transfer the pdf back to mac os x. what a pain !
    You could use another browser on the Mac instead, such as Camino. That downloaded the file without any problems.

  • FTP URL on OCS10g Content Services

    I can't find a FTP URL on OCS10g Content Services.
    How to connect FTP service of OCS 10g Content Services?

    Finally, I can connect to workspaces successfully.
    I was confused between Original FTP and OCS FTP.
    OCS FTP concept is different from Original FTP one.
    OCS FTP stores files to Database, not File system.
    Step by step OCS FTP
    STEP 1. Enabling FTP
    ====================
    Oracle® Content Services
    Administrator’s Guide
    10g Release 1 (10.1.1)
    B14493-01
    Page. 4-3
    You can enable FTP for Oracle Content Services so that users can upload and
    download files using FTP. The FTP protocol is disabled by default after Oracle Content
    Services is installed and configured.
    To enable the Oracle Content Services FTP server:
    1. Access the Oracle Collaboration Suite Control and navigate to the Content
    Services Home page.
    2. You may want to change the default port number for the FTP server. To do this:
    a. In the Administration section, click Server Configurations.
    b. Click FtpServerConfiguration.
    c. Click IFS.SERVER.PROTOCOL.FTP.Port, in the Properties section.
    d. Update the Value with the desired port number and click OK.
    e. Click OK on the Edit Server Configuration page.
    3. Return to the Content Services Home page and click Node Configurations, in the
    Administration section.
    4. Click the name of the node configuration that corresponds to the node where you
    want to run the FTP server. You can only run the FTP server on regular nodes; you
    cannot run FTP on HTTP nodes.
    5. Scroll down to the Servers table and click FtpServer.
    6. Select Active and Initially Started.
    7. Click OK on the Edit Server page.
    8. Click OK on the Edit Node Configuration page.
    9. Return to the Content Services Home page and restart the node.
    Repeat this procedure for any additional regular nodes on which you want to run FTP.
    STEP 2. SET FTP password
    ========================
    Oracle® Collaboration Suite
    Security Guide
    10g Release 1 (10.1.1)
    B14489-01
    Page. 2-27
    Users can set their FTP password in the Oracle Internet Directory Self-Service
    Console, by setting the IFS password entry that appears in the Application Passwords
    section of the Change Password page.
    STEP 3. Connect FTP Site
    ========================
    In the Windows command prompt
    ftp <server name>
    username and password is not OS account.
    You must use OCS account to connect to workspaces.
    You must reset password for FTP.
    FTP password is different from Portal password.

  • Can't create hyperlink with FTP:// URL

    I am unable to create hyperlinks within iWeb 1.1.1 to anything other than http:// URLs. I am trying to create a link that points to an external ftp server in the form of:
    ftp://ftp.tattercoats.com
    It appears that the only URLs recognized and/or accepted by iWed are http:// URLs -- which is pretty limiting considering that there are ftp:// ftps:// and https:// sites out there.
    How do I accomplish this?
    Thanks!! Erik

    Welcome to the discussions, Erik.
    Those other URL's are not allowed within iWeb. You CAN edit the html after publishing, though, to add them.

  • Can you change the FTP URL for Azure Websites and link to a Domain Name FTP?

    I have created an Azure Website, and have regisetered the correct Domain Name details for the site. What i want to understand is can i do the same for the FTP address via Azure?
    Rather than use the default ftp://waws-XXX-XXX.ftp.azurewebsites.windows.net/ i want to change to be FTP.<Domain Name>.comi do not see the option to do this via Azure?
    would i have to create a CNAME on my domain registrar to deal with this instead?

    are you able to ftp to domainname.ext?
    if you can ftp to domainname.ext and instead you want to ftp to FTP.domainname.ext then yes you need dns map

  • Space to %20 problem in ftp url...

    Hi friends,
    I want a href link which should download a pdf file inside a folder with folder name containing space say i want a link like :
    D:\jboss\server\default\.\deploy\myexample.war\Docs\example 1.0\e1.pdf
    so , it has a space in between example and 1.0
    When I hover the mouse it shows D:\jboss\server\default\.\deploy\myexample.war\Docs\example%201.0\e1.pdf , so it could not find the file name with example%201.0 and doesnt go there. the browser automatically converts the space to %20.
    if I put the same link D:\jboss\server\default\.\deploy\myexample.war\Docs\example 1.0\e1.pdf directly in the browser address it shows the file... Can any one help ??
    Thanks!!

    JavaWorld published an article about this topic. It is called "Java FTP client libraries reviewed" and it can be found here :
    http://www.javaworld.com/javaworld/jw-04-2003/jw-0404-ftp.html
    Best regards
    Jean-Pierre Norguet
    Jean-Pierre Norguet
    JavaWorld Press
    http://wasa.ulb.ac.be/jp.html

  • Read file from URL and save to FTP

    Hi,
    I have worked in java few years back, now I am out of touch. My friend asked me to create an applet program for him which he can use to download a file from remote location to his ftp server.
    For e.g.
    File
    http://www.demo.com/filename.avi
    Saved to
    ftp://username:password@ftpsite_address/foldername
    I was searching for the classes which I can use to achieve this functionality.
    To save to FTP
    URL url = new URL("ftp://username:[email protected]/folder/filename");
    URLConnection urlconnection = url.openConnection();
    long l = urlconnection.getContentLength();
    OutputStream outputstream = null;
    outputstream = urlconnection.getOutputStream();Using the above code I can get the outputstream to which I can write.
    I am now stuck here, have some doubts.
    What all classes should I use to read a file like
    http://www.demo.com/filename.avi
    I know I can use URL to open connection to URLS and then streams to read the url.
    I am interested in knowing the class which I should use to read any type of file. File can be zip/avi/rar or anything else.
    What all method of the class should I use to read the file which will support all type of files.
    Which classes should I use to write the files. The files are going to be huge in terms of size.
    I have searched everywhere but every place different classes are used.
    Any help is appreciated.

    Ok now I have started coding but facing a problem.
    [PHP]try {
         URL url = new URL("http://url_to_file/test.txt");
         URLConnection urlconnection = url.openConnection();
         long l = urlconnection.getContentLength();
         fTextArea.append("Content Length = " + l);
         BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
         String line;
         while ((line = in.readLine()) != null)
              fTextArea.append("\n"+line);
         in.close();
    } catch (Exception e) {
    fTextArea.append(e);
    return;
    [PHP]
    When I run this code locally it works fine but when run in browser it shows security exception
    java.security.AccessControlException: access denied (java.net.SocketPermission site:80 connect,resolve)
    What should I do to resolve this error. Sorry for being such a noob but do not have much info about this.

  • Installed j2re1.4.0_03 succesfully, but unable to find javac

    Hi,
    I installed j2re1.4.0_03, but could not find javac.exe in C:\j2re1.4.0_03\bin dir.
    I did find java.exe and javaw.exe in the above dir.
    Can somebody help me resolving this problem.
    Thanks,

    I tried to install both the latest version j2re1.4.1_01 and j2re1.r.0_03 figuring the latest version may have had the problem. I could not locate the compiler in either attempt.

  • How to configure external FTP backup server CISCO NCS 1.1

    How do you configure a external FTP Server for Cisco NCS 1.1? I only get setup username/password, i also need to setup FTP server IP and directory.           

    from the CLI you setup a repository,
    conf t
    repository FTP
    url ftp://
    username < username> password
    exit
    http://www.cisco.com/en/US/docs/wireless/ncs/1.0/command/reference/cli_app_a.html#wp1013913
    HTH,
    Steve
    Please remember to rate useful posts, and mark questions as answered

  • Problem FTP Stor with iSeries

    Hello,
    Here is my problem. I try desperately to upload the content of a file to an IBM iSeries (AS400) in a java program.
    I have found the way to download the content of a file from iSeries to PC, that's made by the method getFileContent, and it works fine.
    But I cannot upload the content of a text file in my PC to the iSeries and I don't know why. I use for this the
    setFileContent method. The file specified on the iSeries to receive my datas is well created or cleared (if it aready exists), but it stays desperately empty. No data seem to be written in. I have also tried to use the appe command, but it doesn't work anyway.
    Please can someone help me and find what's wrong in my code, and how to do this?
    Thank you very much
    import java.net.Socket;
    import java.io.BufferedReader;
    import java.io.PrintWriter;
    import java.io.InputStreamReader;
    import java.io.IOException;
    import java.util.regex.*;
    import java.io.*;
    public class FTPClient {
    static int portDatas;
    private BufferedReader in = null;
    private BufferedReader in2 = null;
    private PrintWriter out = null;
    private BufferedWriter out2 = null;
    private Socket socket = null;
    private String hostName;
    private int hostPort;
    private String user;
    private String password;
    private String library;
    private String file;
    private String member;
    private boolean isPASV;
    private FTPClient commandPort;
    private FTPClient datasPort;
    static StringBuffer fileContent = new StringBuffer();
    private static boolean stopped = false;
    private int mode;
    static BufferedWriter bufferedWriter;
    private File fileMember = null;
    private String fileSeparator = System.getProperty("file.separator");
    // Constructeur priv�
    private FTPClient(boolean isPASV) {
    this.isPASV = isPASV;
    // Constructeur publique
    public FTPClient(String hostName, int hostPort, String user, String password)
    this.hostName = hostName;
    this.hostPort = hostPort;
    this.user = user;
    this.password = password;
    commandPort = new FTPClient(true);
    datasPort = new FTPClient(false);
    // M�thode servant � rappatrier sous forme d'une String, le contenu d'un membre AS400
    public String getFileContent(String library, String file, String member){
    commandPort.library = library;
    commandPort.file = file;
    commandPort.member = member;
    if (commandPort.open(hostName, hostPort)) {
    commandPort.login(user, password);
    commandPort.passive();
    if (datasPort.open(hostName, portDatas)){
    commandPort.retrieve();
    return datasPort.getContent();
    // M�thode servant � rappatrier sous forme d'un Fichier txt, le contenu d'un membre AS400
    public String getFile(String library, String file, String member, String folderPath){
    boolean fileOk = false;
    commandPort.library = library;
    commandPort.file = file;
    commandPort.member = member;
    if (! folderPath.trim().endsWith(fileSeparator)) {
    folderPath += fileSeparator;
    if (commandPort.open(hostName, hostPort)) {
    commandPort.login(user, password);
    commandPort.passive();
    if (datasPort.open(hostName, portDatas)){
    fileMember = new File(folderPath + member + ".txt");
    try {
    fileOk = fileMember.createNewFile();
    bufferedWriter = new BufferedWriter(new FileWriter(fileMember));
    commandPort.retrieve();
    bufferedWriter.write(datasPort.getContent());
    bufferedWriter.close();
    catch (IOException ex) {
    fileOk = false;
    if (fileOk) {
    return fileMember.getAbsolutePath() ;
    else {
    return "";
    // M�thode servant � rappatrier vers l'AS400, un DSPF se trouvant dans un fichier
    public void setFileContent(String library, String file, String member, String filePath){
    commandPort.library = library;
    commandPort.file = file;
    commandPort.member = member;
    if (commandPort.open(hostName, hostPort)) {
    commandPort.login(user, password);
    commandPort.passive();
    if (datasPort.open(hostName, portDatas)){
    commandPort.store(filePath);
    datasPort.meuh(filePath);
    private boolean isMsgValid(String msg, String code) {
    if (msg != null && msg.startsWith(code)) {
    return true;
    return false;
    private boolean readWelcomeMessage() {
    String msg = waitLine();
    //System.out.println(msg);
    return isMsgValid(msg,"220");
    // Ouverture du Socket vers la machine host
    private boolean open(String server, int port) {
    try {
    socket = new Socket(server, port);
    catch (IOException ex) {
    //System.out.println(ex.getMessage());
    return false;
    try {
    in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
    catch (IOException ex) {
    //System.out.println(ex.getMessage());
    return false;
    try {
    out = new PrintWriter(socket.getOutputStream());
    out2 = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));
    catch (IOException ex) {
    //System.out.println(ex.getMessage());
    return false;
    if(isPASV) // si port de commandes
    readWelcomeMessage();
    else // si port des donn�es
    stopped = true;
    new Thread()
    public void run()
    try {
    String line=null;
    while (true) {
    line = in.readLine();
    if (null != line) {
    fileContent.append(line + "\n");
    }else
    stopped=false;
    break;
    catch (IOException ex1) {
    ex1.printStackTrace();
    }.start();
    return true;
    private synchronized String getContent()
    while(stopped)
    try {
    Thread.sleep(200);
    catch (InterruptedException ex) {
    break;
    String ret = fileContent.toString();
    fileContent.setLength(0);
    return ret;
    // Fermeture de la connexion
    private void close() {
    try {
    out.close();
    in.close();
    socket.close();
    catch (Exception fe) {
    //System.out.println("RESOURCE CLOSE EXCEPTION " + fe.getMessage());
    private String waitLine() {
    try {
    return in.readLine();
    catch (IOException ex) {
    return null;
    // Connexion � la machine avec utilisateur et mot de passe
    private boolean login(String user, String pass) {
    if (sendUser(user)) {
    return sendPass(pass);
    else {
    return false;
    // Passage du nom d'utilisateur
    private boolean sendUser(String user) {
    out.println("user " + user);
    out.flush();
    try {
    String line = in.readLine();
    //System.out.println(line);
    return isMsgValid(line,"220");
    catch (IOException ex) {
    return false;
    // Passage du mot de passe
    private boolean sendPass(String pass) {
    try {
    String line = in.readLine();
    //System.out.println(line);
    if (line != null && isMsgValid(line,"331")) {
    else
    return false;
    catch (IOException ex) {
    return false;
    out.println("pass " + pass);
    out.flush();
    try {
    String line = in.readLine();
    //System.out.println(line);
    if (line != null && isMsgValid(line,"230")) {
    return true;
    catch (IOException ex) {
    return false;
    return false;
    // Passage en mode passif avec r�cup�ration du port de transfert de donn�es
    private boolean passive(){
    out.println("pasv" );
    out.flush();
    try {
    String line = in.readLine();
    Pattern p2 = Pattern.compile("((\\d)+,(\\d)+,(\\d)+,(\\d)+,((\\d)+),((\\d)+))", Pattern.CASE_INSENSITIVE);
    Matcher m2 = p2.matcher(line);
    if (m2.find(1)) {
    portDatas = (Integer.parseInt(m2.group(6)) << 8) + Integer.parseInt(m2.group(8));
    //System.out.println(line);
    return true;
    catch (IOException ex) {
    return false;
    // R�cup�ration du contenu du fichier pass� en param�tre � la m�thode getSource
    private boolean retrieve(){
    out.println("retr "+ library + "/" + file + "." + member);
    out.flush();
    try {
    String line = in.readLine();
    //System.out.println(line);
    return true;
    catch (IOException ex) {
    return false;
    // Copie du contenu du fichier en direction de l'host
    private boolean store(String filePath){
    out.println("stor "+ library + "/" + file + "." + member);
    out.flush();
    /*try {
    String line = in.readLine();
    System.out.println(line);
    BufferedReader bufferedReader = new BufferedReader(new FileReader(filePath));
    String str;
    while ((str = bufferedReader.readLine()) != null) {
    out.write(str);
    out.flush();
    System.out.println(str);
    bufferedReader.close();
    return true;
    catch (IOException ex) {
    return false;
    return true;
    private void meuh(String filePath){
    try {
    BufferedReader bufferedReader = new BufferedReader(new FileReader(filePath));
    String str;
    while ((str = bufferedReader.readLine()) != null) {
    out2.write(str);
    out2.flush();
    System.out.println(str);
    bufferedReader.close();
    catch (IOException ex) {
    System.out.println(ex.getMessage());
    // Finalisation (fermeture des ports)
    protected void finalize() {
    commandPort.close();
    datasPort.close();
    }

    any problem with using the builtin ftp url abilities in jdk1.5 or any of the available ftp libraries?
    If you have to do it yourself, I would seriously recommend investigating the difference between binary and ascii transfer and not always using the BufferedReader/PrintWriter technique.
    use formatting as described here http://forum.java.sun.com/faq.jsp#format

  • HOW to read file using ftp???

    Hi to all,
    I have problem with reading file using ftp connection, i want to read only 1024 bytes for one time, and i have
    next code wich read this:
    byte buffer[] = new byte[1024];
    while( (readCount = input.read(buffer)) > 0) {
    bos.write(buffer, 0, readCount);
    but I dont know how to put all read data in one byte[] if i dont know length of file.
    I can't do some like: byte file[] = new file[1000000];
    Thanks for all sugestions!

          * Download a file from a FTP server. A FTP URL is generated with the following syntax:
         * <code>ftp://user:password@host:port/filePath;type=i</code>.
          * @param ftpServer FTP server address (incl. optional port ':portNumber').
          * @param user Optional user name to login.
          * @param pwd Optional password for <i>user</i>.
          * @param fileName Name of file to download (with optional preceeding relative path, e.g. one/two/three.txt).
          * @param destination Destination file to save.
         * @throws MalformedURLException, IOException on error.
         public void download(String ftpServer, String user, String pwd, String fileName, File destination) throws MalformedURLException, IOException {
            if (ftpServer != null && fileName != null && destination != null) {
                StringBuffer sb = new StringBuffer("ftp://");
                if (user != null && pwd != null) { //need authentication?
                    sb.append(user);
                    sb.append(':');
                    sb.append(pwd);
                    sb.append('@');
                }//else: anonymous access
                sb.append(ftpServer);
                sb.append('/');
                sb.append(fileName);
                sb.append(";type=i"); //a=ASCII mode, i=image (binary) mode, d= file directory listing
                BufferedInputStream bis = null;
                BufferedOutputStream bos = null;
                try {
                    URL url = new URL(sb.toString());
                    URLConnection urlc = url.openConnection();
                    bis = new BufferedInputStream(urlc.getInputStream());
                    bos = new BufferedOutputStream(new FileOutputStream(destination.getName()));
                    int i;
                    while ((i = bis.read()) != -1) { //read next byte until end of stream
                        bos.write(i);
                    }//next byte
                } finally {
                    if (bis != null) try { bis.close(); } catch (IOException ioe) { /* ignore*/ }
                    if (bos != null) try { bos.close(); } catch (IOException ioe) { /* ignore*/ }
            }//else: input unavailable
        }//download()If you don't want to strore the data into a file, use ByteArrayOutputStream instead of a FileOutputStream.

  • Can I dynamically select the FTP account and destination?

    I have a situation where, dependent, on a field in the contents of a CSV file I need to FTP it to a certain location.
    Now there are over 40 cases and I'd rather not set up 40 outbound FTP services, each with their own account but would rather have just one and dynamically set the account information from a configuration available from within the pipeline (i.e. via some user defined properties).
    Is there a way of doing this?
    regards

    I've made some progress on this. The XQuery function:
    fn-bea:lookupBasicCredentials
    can be used to get service account information at run time so now all I need is to be able to override some header values so that the FTP transport uses them instead but also need a means to change the FTP URL.
    Surely someone has come across this problem before and solved it?

  • Using ftp in core java code to transferring a file to other sys

    My mail id:[email protected]
    hi to all
    I am actually using this code for transforing a file from my system to side system of mine.but the code is compiling and when runing this code i am getting an error:
    java.net.ConnectException: Connection refused: connect
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(Unknown Source)
    at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
    at java.net.PlainSocketImpl.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at java.net.Socket.<init>(Unknown Source)
    at java.net.Socket.<init>(Unknown Source)
    at com.sshtools.j2ssh.net.SocketTransportProvider.<init>(Unknown Source)
    at com.sshtools.j2ssh.net.TransportProviderFactory.connectTransportProvider(Unknown Source)
    at com.sshtools.j2ssh.SshClient.connect(Unknown Source)
    at com.sshtools.j2ssh.SshClient.connect(Unknown Source)
    at com.sshtools.j2ssh.SshClient.connect(Unknown Source)
    at ftpsample1.main(ftpsample1.java:36)
    I am getting this error.
    friend is saying some proxy should should be installed in that other system.
    Plase help me..
    my code is:
    import java.io.File;
    import java.util.List;
    import java.io.*;
    import com.sshtools.j2ssh.SftpClient;
    import com.sshtools.j2ssh.SshClient;
    import com.sshtools.j2ssh.authentication.AuthenticationProtocolState;
    import com.sshtools.j2ssh.authentication.PasswordAuthenticationClient;
    import com.sshtools.j2ssh.sftp.SftpFile;
    import org.apache.commons.logging.Log;
    import org.apache.commons.logging.LogFactory;
    class ftpsample1
         public static void main(String[] args) {
         String username="administrator";
         String password="thota1976";
    try{
    // Make a client connection
    System.out.println("Before SSHCLIENT......");
    SshClient ssh = new SshClient();
         System.out.println("After SSHCLIETNT ......");
    // Connect to the host
    System.out.println("Connecting ......");
    System.out.println("ssh.connect ->9.182.54.70*************************......");
         ssh.connect("9.182.54.70");
    System.out.println("Connected***");
         // Create a password authentication instance
    PasswordAuthenticationClient pwd = new PasswordAuthenticationClient();
         // Get the users name
    pwd.setUsername(username);
         // Get the password
    pwd.setPassword(password);
         // Try the authentication
    int result = ssh.authenticate(pwd);
         System.out.println("ssh.authenticate(pwd):::" +result);
    System.out.println("AuthenticationProtocolState.COMPLETE:::***:" +AuthenticationProtocolState.COMPLETE);
              System.out.println("Beforet he AuthenticationProtocolState.COMPLETE ::");
         if (result == AuthenticationProtocolState.COMPLETE) {
              System.out.println("BOTH ARE SAME RESULT AND .COMPLETED*--------------");
    // The connection is authenticated we can now do some real work!
    SftpClient sftp = ssh.openSftpClient();
              sftp.put("c:/temp/Balaji.jpg");
                   System.out.println("after he AuthenticationProtocolState.COMPLETE ::");
    }catch(Exception e)
                        e.printStackTrace();
                        System.out.println("*****");
                        e.getMessage();

    You could use only Java classes without and 3rd party classes (com.sshtools.j2ssh) for doing this:
         * Upload a file to a FTP server. A FTP URL is generated with the following syntax:
         * <code>ftp://user:password@host:port/filePath;type=i</code>.
         * @param ftpServer FTP server address (incl. optional port ':portNumber').
         * @param user Optional user name to login.
         * @param pwd Optional password for <i>user</i>.
         * @param fileName Destination file name on FTP server (with optional preceeding relative path, e.g. "one/two/three.txt").
         * @param source Source file to upload.
         * @throws MalformedURLException, IOException on error.
        public void upload(String ftpServer, String user, String pwd, String fileName, File source) throws MalformedURLException, IOException {
            if (ftpServer != null && fileName != null && source != null) {
                StringBuffer sb = new StringBuffer("ftp://");
                if (user != null && pwd != null) { //need authentication?
                    sb.append(user);
                    sb.append(':');
                    sb.append(pwd);
                    sb.append('@');
                }//else: anonymous access
                sb.append(ftpServer);
                sb.append('/');
                sb.append(fileName);
                sb.append(";type=i"); //a=ASCII mode, i=image (binary) mode, d= file directory listing
                BufferedInputStream bis = null;
                BufferedOutputStream bos = null;
                try {
                    URL url = new URL(sb.toString());
                    URLConnection urlc = url.openConnection();
                    bos = new BufferedOutputStream(urlc.getOutputStream());
                    bis = new BufferedInputStream(new FileInputStream(source.getName()));
                    int i;
                    while ((i = bis.read()) != -1) { //read next byte until end of stream
                        bos.write(i);
                    }//next byte
                } finally {
                    if (bis != null) try { bis.close(); } catch (IOException ioe) { /* ignore*/ }
                    if (bos != null) try { bos.close(); } catch (IOException ioe) { /* ignore*/ }
            }//else: input unavailable
        }//upload()

Maybe you are looking for

  • Moving home directories best practice

    I have storage manager 2.5 installed and working well and my users managed. I have about 200 users in different OUs that I want to move storage from one NW65 to another NW65. How do I go about doing this in a smooth fashion without downtime for the u

  • Can menu bar use variants instead of hard coding in GUI Status?

    Hi Experts, I am trying to select data into a variant from one table. This variant will be used for text in Menu Bar of GUI Status. I used to hard coding in Menu Bar. Is it possible for variants instead of hard coding in Menu Bar? If not, any flexibl

  • Problems with the Galaxy Nexus

    I upgraded to the Galaxy Nexus – your flagship device.  It now has a whole laundry list of known, critical issues.  You're holding the Android software update that will fix these known problems but you won't release it.  After 5 months, still no fix.

  • Migrate tracking information

    Ouch! I can find none of the tracking data for files I had sent previously via "SendNow" (and before you forced me over to "Send". Adobe, where is this tracking data?

  • Acknowledgement in Proxy

    can u please tell me about Acknowledgement In Proxy.