Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
3k views
in Java FTP by (160 points)
Hello,

I use edtftpj-1.5.4 for Java with NetBeans IDE 5.5...Here's my sourcecode:

/**
 *  trivial ftp handling with java
 *
 *  @author      Peter Wyss
 *  @version     1.0
 */
import com.enterprisedt.net.ftp.FTPClient;
import com.enterprisedt.net.ftp.FTPTransferType;
import com.enterprisedt.net.ftp.FTPConnectMode;

public class ftp {

    public static void main(String[] args) {
        
        printHeader();
        // 3 arguments needed (remotehost, user and password)
        if (args.length > 0) {
            doFTP(args[0],args[1],args[2],args[3]);
        }
        else{
            printHelp();
        }
    }
    
    public static void doFTP(String host, String user, String password, String file){
        try
        {
            System.out.println("> connect to " + host + "\n");
            System.in.read();
            
            FTPClient ftp = null;
            ftp = new FTPClient();
            ftp.setRemoteHost(host);
            ftp.connect();
            ftp.login(user, password);
            
            System.out.println("\n" + "> set passive, binary mode" + "\n");
            System.in.read();
            System.in.read();
            
            ftp.setConnectMode(FTPConnectMode.PASV);
            ftp.setType(FTPTransferType.BINARY);

            System.out.println("\n" + "> uploading " + file + "\n");
            System.in.read();
            System.in.read();
            
            ftp.put(file,file);
            
            System.out.println("\n" +  "> closing ftp connection" + "\n");
            System.in.read();
            System.in.read();

            ftp.quit();            
        }
        catch (Exception e) {
            System.out.println("Caught Error: " + e.getMessage());
        }
    }   
    
    /**
     *  Basic usage statement
     */
    public static void printHelp() {

        System.out.println("Usage: ftp.jar host user password file");
    }
    
    private static void printHeader() {
        System.out.println("**************************************");
   System.out.println("ftp connection with java");
   System.out.println("**************************************" + "\n");
    }
}


When the program connects, here:
            FTPClient ftp = null;
            ftp = new FTPClient();
            ftp.setRemoteHost(host);
            ftp.connect();
            ftp.login(user, password);


I get the following error:

Failed to calculate version: For input string: "@major_ver@"


I read in other posts already about this error, but I can't resolve it.

What do I have exactly to do to resolve this issue?

Peter

3 Answers

0 votes
by (162k points)
This is because you are including the source code in your application I imagine, and the version number is added by ant, using a substitution. You can fix this by hard coding the version numbers in VersionDetails.java, in the static version fields.

We'll make a note to fix this in the next release, which we hope will be out by the end of this month.
0 votes
by (160 points)
This is because you are including the source code in your application I imagine, and the version number is added by ant, using a substitution. You can fix this by hard coding the version numbers in VersionDetails.java, in the static version fields.

We'll make a note to fix this in the next release, which we hope will be out by the end of this month.


Thanks! It works with the edit of the VersionDetails.java file...

Greets,
Peter
0 votes
by (162k points)
Just to follow up on this post ... as edtFTPj is licensed under the LGPL, if you compile the code into your application, under the terms of the LGPL, you are implicitly licensing your own code under the LGPL as well.

If you are writing commercial code that you do not want licensed under the LGPL, there are two options.

1) Use the library as a jar file - the LGPL allows commercial use in this case

2) purchase a non-GPL license from us for $99. This helps to fund further work on edtFTPj.

The full text of the LGPL can be found here.

This is because you are including the source code in your application I imagine, and the version number is added by ant, using a substitution. You can fix this by hard coding the version numbers in VersionDetails.java, in the static version fields.

We'll make a note to fix this in the next release, which we hope will be out by the end of this month.

Categories

...