Results 1 to 8 of 8
- 05-10-2012, 06:47 PM #1
Member
- Join Date
- Feb 2010
- Posts
- 36
- Rep Power
- 0
java.lang.noClassDefFoundException using JDom2
Hey all,
I am tryng to create a jarfile which has always worked until now.
I am using the JDom jar's for xml and when trying to execute the jar from the terminal I get this:
Exception in thread "main" java.lang.NoClassDefFoundError: org/jdom2/JDOMException
Caused by: java.lang.ClassNotFoundException: org.jdom2.JDOMException
at java.net.URLClassLoader$1.run(URLClassLoader.java: 217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.j ava:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:3 21)
at sun.misc.Launcher$AppClassLoader.loadClass(Launche r.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:2 66)
Could not find the main class: SettingsScreen. Program will exit.
I've searched the web and I find information but I'm pretty new when it comes to classpaths and stuff like that so basically I do not know how I can solve this.
Any assistance would be very very much appreciated since this really bugs me and I do not own the skill to solve it myself.
- 05-10-2012, 06:54 PM #2
Re: java.lang.noClassDefFoundException using JDom2
Where is the definition for that class? Is its class file in some jar file? If you have the jar file with the missing class file, you can use the Class-Path: entry in the manifest file that goes into your jar file to refer to the jar file with the missing class. Put all the jar files in the same folder.
If you don't understand my response, don't ignore it, ask a question.
- 05-10-2012, 06:58 PM #3
Member
- Join Date
- Feb 2010
- Posts
- 36
- Rep Power
- 0
Re: java.lang.noClassDefFoundException using JDom2
The manifest in the jar only contains these lines:
Manifest-Version: 1.0
Created-by: GJar (Welcome | Daik.se)
Main-Class: SettingsScreen
edit:
the jar content contains all my own classfiles, the meta-inf folder and the 5 jdom jar files. All immediatelly inside the same jar.Last edited by senca; 05-10-2012 at 07:01 PM.
- 05-10-2012, 07:05 PM #4
Re: java.lang.noClassDefFoundException using JDom2
Did you try adding the Class-Path: entry to your manifest file?
The java program does NOT use jar files contained inside of other jar files. The jar files need to all be outside of any jar file.If you don't understand my response, don't ignore it, ask a question.
- 05-10-2012, 08:39 PM #5
Member
- Join Date
- Feb 2010
- Posts
- 36
- Rep Power
- 0
- 05-10-2012, 08:46 PM #6
Re: java.lang.noClassDefFoundException using JDom2
Sorry, where did I say to add classpath?
jar files in a jar file are not used by the java command.If you don't understand my response, don't ignore it, ask a question.
- 05-11-2012, 12:21 PM #7
Member
- Join Date
- Feb 2010
- Posts
- 36
- Rep Power
- 0
- 05-11-2012, 01:08 PM #8
Similar Threads
-
java.lang.NoSuchMethodError: org.apache.log4j.Logger.log(Ljava/lang/String;Lorg/apach
By rameshraj in forum JDBCReplies: 5Last Post: 03-17-2011, 02:26 PM -
java.lang.ClassNotFoundException: com.sun.star.lang.XEventListener
By Leroy in forum Advanced JavaReplies: 8Last Post: 11-04-2010, 01:46 PM -
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/star/lang/XEventLi
By baktha.thalapathy in forum New To JavaReplies: 5Last Post: 06-02-2010, 01:05 PM -
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/star/lang/XEventLi
By baktha.thalapathy in forum Advanced JavaReplies: 3Last Post: 06-01-2010, 03:01 PM -
Error: cannot resolve symbol' on Person (java.lang.String, java.lang.String)
By baltimore in forum New To JavaReplies: 2Last Post: 09-18-2008, 07:30 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks