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