This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NoClassDefFoundError with JDOM

 
Michael Krause
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 216
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you tell us what your classpath settings are?
 
Michael Krause
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 216
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic