wood burning stoves 2.0*
The moose likes XML and Related Technologies and the fly likes NoClassDefFoundError with JDOM Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "NoClassDefFoundError with JDOM" Watch "NoClassDefFoundError with JDOM" New topic
Author

NoClassDefFoundError with JDOM

Michael Krause
Greenhorn

Joined: Jul 13, 2001
Posts: 2
Hi,
I copied the following listing from the book "Java and XML":
import java.io.File;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;
public class SAXTest {

public static void main(String[] args) {
if (args.length != 1) {
System.out.println("Start: SAXTest [Filename]");
return;
}

try {
SAXBuilder builder = new SAXBuilder(false);
Document doc = builder.build(new File(args[0]));
System.out.println("File read correctly");
} catch (JDOMException e) {
e.printStackTrace();
}//end of catch
}//end of main
}//end of class
The JDom-jar File is in \jdk1.3.1\jre\lib\ext just like the File xerces.jar.
Compiling gives me no error but as I start the program with
java saxtest file.xml
it gives me a
java.lang.NoClassDefFoundError: org/jdom/JDOMException.
Can anybody tell me, what causes this error?
thanx in advance
Michael
Vladan Radovanovic
Ranch Hand

Joined: Mar 20, 2000
Posts: 216
Can you tell us what your classpath settings are?
Michael Krause
Greenhorn

Joined: Jul 13, 2001
Posts: 2
Of course, here they are including PATH and JAVA_HOME:
SET PATH=%PATH%;D:\Programme\Programming\jdk1.3.1\bin;D:\Programme\Programming\jdk1.3.1\xerces-1_4_1;D:\Programme\Programming\jdk1.3.1\jdom-b7\build
SET CLASSPATH=D:\Programme\Programming\jdk1.3.1\bin;D:\Programme\Programming\jdk1.3.1\lib;D:\Programme\Programming\jdk1.3.1\xerces-1_4_1\xerces.jar;D:\Programme\Programming\jdk1.3.1\jd om-b7\build\jdom.rar
SET JAVA_HOME=D:\Programme\Programming\jdk1.3.1
Vladan Radovanovic
Ranch Hand

Joined: Mar 20, 2000
Posts: 216
What happens if you change that jdom.rar into jdom.jar? That is at the end of your classpath setting.
And why do we have space between jd and om-b7? Again, the classpath for jdom.
[This message has been edited by Vladan Radovanovic (edited July 25, 2001).]
 
 
subject: NoClassDefFoundError with JDOM
 
Similar Threads
How read with JDOM
JDOM works normally not with JSP
xml to java objects
Problem Parsing XML file with JDOM.
org.jdom.JDOMException: Error on line -1: Premature end of file.