Skip to Content
author's profile photo Former Member
Former Member

Help required - running a Java program from the command line

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 07, 2005 at 01:29 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 07, 2005 at 12:51 PM

    Hi,

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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.