• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

NoClassDefFoundError with JDOM

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 216
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).]
reply
    Bookmark Topic Watch Topic
  • New Topic