Results 1 to 2 of 2
  1. #1
    phyzix5761 is offline Member
    Join Date
    Nov 2012
    Posts
    43
    Rep Power
    0

    Default Error when trying to run .jar file

    I've compiled my code into a .jar file using netbeans. But once I try to open the .jar file via command line (java -jar Chat.jar) it returns the following error:


    Exception in thread "main" java.lang.NoClassDefFoundError: Main/class
    Caused by: java.lang.ClassNotFoundException: Main.class
    at java.net.URLClassLoader$1.run(URLClassLoader.java: 202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.j ava:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:3 06)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launche r.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:2 47)


    I think what it's saying is that it can't find the Main.class but I unarchived the .jar and know that the file is in there. Any help would be appreciated. Thanks.
    Last edited by DarrylBurke; 11-17-2012 at 10:06 AM. Reason: Marked solved

  2. #2
    phyzix5761 is offline Member
    Join Date
    Nov 2012
    Posts
    43
    Rep Power
    0

    Default Re: Error when trying to run .jar file

    It seems it was some sort of netbeans error because I redid the interface for the program in a new project and it worked perfectly.

Similar Threads

  1. Replies: 6
    Last Post: 02-10-2011, 10:55 AM
  2. How to log error in sql to log file
    By tedy2808 in forum New To Java
    Replies: 1
    Last Post: 08-13-2010, 12:21 PM
  3. Error after build to jar file.
    By bach_meoden in forum AWT / Swing
    Replies: 13
    Last Post: 04-06-2010, 03:27 PM
  4. Jar file error. Please help!
    By x2robbie2x in forum New To Java
    Replies: 1
    Last Post: 02-11-2010, 04:19 AM
  5. File Write Error
    By vikain in forum Advanced Java
    Replies: 5
    Last Post: 01-02-2008, 05:38 AM

Posting Permissions

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