Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
4.1k views
in Java FTP by (820 points)
I wish to create an executable jar file so that user can run my application, but I am having problems getting this to work. So far I have been doing this:

jar cvfm myApp.jar MANIFEST.MF *.class *.gif


I get an executable jar, but when I double click it, nothing happens. I ran this command on the command line

java -jar myApp.jar


and i get this message:

Exception in thread "main" java.lang.NoClassDefFoundError: com/enterprisedt/net/
ftp/FTPProgressMonitor
        at myApp.main(myApp.java:17)


Can anyone suggest how I may go about getting this to work.

5 Answers

0 votes
by (162k points)
Is the edtFTPj jar file available in the PATH?
0 votes
by (820 points)
Yes
0 votes
by (162k points)
That's CLASSPATH of course.

Try printing out the CLASSPATH in the first line of main() to ensure it includes the edt classes.
0 votes
by (820 points)
Ok I've added the line below to print out the classpaths:

System.out.println("Classpaths: " + System.getProperty("java.class.path"));


When compiling and executing with my IDE I get all the classpaths:

classpaths:
N:\java\CoverttApp\classes;
C:\Program Files\Java\jdk1.5.0_05\jre\lib\rt.jar;
C:\Program Files\Java\jdk1.5.0_05\lib\dt.jar;
C:\Program Files\Java\jdk1.5.0_05\lib\tools.jar;
C:\Program Files\Java\jdk1.5.0_05\jre\lib\ext\dnsns.jar;
C:\Program Files\Java\jdk1.5.0_05\jre\lib\ext\localedata.jar;
C:\Program Files\Java\jdk1.5.0_05\jre\lib\ext\sunjce_provider.jar;
C:\Program Files\Java\jdk1.5.0_05\jre\lib\ext\sunpkcs11.jar;
N:\java\CoverttApp\classes\edtftpj-pro.jar


The program works fine this way. At runtime, once I have created the exe jar, I get this:

Classpaths: CoverttApp.jar
Exception in thread "main" java.lang.NoClassDefFoundError: com/enterprisedt/net
ftp/FTPProgressMonitor
at CoverttApp.main(CoverttApp.java:18 )
0 votes
by (820 points)
I've worked it out - I needed to add the class path to the manifest file

Manifest-Version: 1.0 
Main-Class: myApp
Class-Path: edtftpj.jar

Categories

...