| Author |
Exception in thread "main"
|
Joanne Ho
Greenhorn
Joined: Nov 15, 2005
Posts: 3
|
|
I test my program on NetBeans IDE4.1 by calling "Run"->"Run File"->"Run JEMQInterface.java". It runs perfectly ok. Since NetBeans will automatically built a jar file for my program at the "./dist" directory under my project directory i.e. "c:\JEMQInterface", I tried to run the jar file without using NetBeans by executing the following at command prompt: >java JEMQInterface Then it failed to run and produce the exception. Could anyone help. Thanks. Exception in thread "main" java.lang.NoClassDefFoundError: JEMQInterface (wrong name: JEMQInterface/JEMQInterface) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$100(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) [ November 15, 2005: Message edited by: Joanne Ho ]
|
 |
Marilyn de Queiroz
Sheriff
Joined: Jul 22, 2000
Posts: 9033
|
|
To run a jar file, you should type java -jar JEMQInterface.jar
|
JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12911
|
|
Exception in thread "main" java.lang.NoClassDefFoundError: JEMQInterface (wrong name: JEMQInterface/JEMQInterface) There's something wrong with the directory structure in your JAR file. You have a "package JEMQInterface;" statement in your source file, but the class file is in the root inside the JAR file, instead of in a subdirectory JEMQInterface.
|
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
|
 |
 |
|
|
subject: Exception in thread "main"
|
|
|