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

    Default Program Runs in NetBEans but Not in cmd

    Hello,

    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:

    .;C:\niall\Java\jdk1.6.0_02;C:\mysql-connector-java-3.0.17-ga\mysql-connector-java-3.0.17-ga-bin.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
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    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, 06:41 PM
  2. Replies: 2
    Last Post: 09-12-2008, 06:10 PM
  3. Executing a program within a program
    By gibsonrocker800 in forum New To Java
    Replies: 5
    Last Post: 05-12-2008, 08:24 AM
  4. Replies: 0
    Last Post: 04-04-2008, 02:40 PM
  5. Replies: 0
    Last Post: 10-04-2007, 09: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
  •