Results 1 to 2 of 2
  1. #1
    MeathUltra is offline Member
    Join Date
    Oct 2008
    Rep Power

    Default Program Runs in NetBEans but Not in cmd


    I have a java application which I built with NetBeans 6.1 which connects to a MySql DB. When I run the application using F6 in NetBeans, everything runs correctly.

    However, when I run the application through the command line with this command:

    java -jar "C:\niall\RTN\dist\RTN_Report_Manager.jar"

    I get the following error:

    java.lang.noclassdeffounderror: com/mysql/jdbc/Connection

    I believe this is to do with a jar file minssing from the classpath. However, my classpath includes the location of the jar:


    I have also tried to run the program on the command line with the following commands, both give the same werror as above:

    java -jar C:\path to my sql jar -jar "C:\niall\RTN\dist\RTN_Report_Manager.jar"

    Any help would be greatly appreciated.:)

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Colombo, Sri Lanka
    Blog Entries
    Rep Power


    First of all, to run a jar file on command prompt no need to use double quotes to the path.

    Once you build the project check that all libraries are attach into the dist\lib folder path.

    Before run on the command prompt try to from the dist folder by double clicking on the jar file. What happen on that time?

    Basically this is not an issue with the class path. Because class path issues should effected on NetBeans

Similar Threads

  1. [SOLVED] App runs only in IDE
    By hannehomuth in forum Advanced Java
    Replies: 4
    Last Post: 07-15-2009, 07:41 PM
  2. Replies: 2
    Last Post: 09-12-2008, 07:10 PM
  3. Executing a program within a program
    By gibsonrocker800 in forum New To Java
    Replies: 5
    Last Post: 05-12-2008, 09:24 AM
  4. Replies: 0
    Last Post: 04-04-2008, 03:40 PM
  5. Replies: 0
    Last Post: 10-04-2007, 10:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts