cancel
Showing results for 
Search instead for 
Did you mean: 

Help required - running a Java program from the command line

Former Member
0 Kudos

Hi,

I have a small non-graphical Java application, packaged into a Jar file. My program relies on classes in another (external) Jar file.

When I run the application from the IDE, everything works fine. However, when I try to run the application from the command line, I keep getting a NoClassDefFoundError for classes in the external jar.

Both the application jar file and the external jar file are in my root directory (C:\).

My command line call is as follows:


java -cp c:MyExternalLib.jar -jar MyApp.jar

Any help greatly appreciated.

Thanks,

Walter

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi,

set classpath=%classpath%;c:\myjar.jar;

here i have specified myjar.jar file as an example u give ur location.after setting the classpath run ur java application.

java mypgm

this will solve ur problem

regards,

Ganesh

Former Member
0 Kudos

Ganesh - you are the greatest! This solved my problem

Thanks,

Walter

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Did you try putting all the files in the \bin folder of the jdk installation.