[jdom-interest] Request for help: getting started ...
Ian Lea
ian.lea at blackwell.co.uk
Thu Aug 16 01:38:59 PDT 2001
You need xerces (or another parser) in the classpath. Adding the lib/
directory by itself doesn't work - add /lib/xerces.jar instead. Also
most people use a jdom jar rather than class files.
--
Ian.
Bob Tykulsker wrote:
>
> Hello World,
>
> I am having trouble building the PrettyPrinter class documented in
> http://www.javaworld.com/javaworld/jw-05-2000/jw-0518-jdom-2.html
>
> 1) I downloaded and installed jdk1.3.1 and jdom-b7
>
> 2) I set my CLASSPATH as follows:
> % echo $CLASSPATH
> .:/home/bobt/apps/jdom-b7/lib:/home/bobt/apps/jdom-b7/build:/home/bobt/apps/
> jdom-b7/build/classes:/home/bobt/apps/jdk1.3.1/lib
>
> 3) I create the file PrettyPrinter.java as follows
> [bobt at gw boggle]$ cat PrettyPrinter.java
> import java.io.*;
> import org.jdom.*;
> import org.jdom.input.*;
> import org.jdom.output.*;
>
> public class PrettyPrinter {
> public static void main(String[] args) {
> // Assume filename argument
> String filename = args[0];
>
> try {
> // Build the document with SAX and Xerces, no validation
> SAXBuilder builder = new SAXBuilder();
> // Create the document
> Document doc = builder.build(new File(filename));
>
> // Output the document, use standard formatter
> XMLOutputter fmt = new XMLOutputter();
> fmt.output(doc, System.out);
> } catch (Exception e) {
> e.printStackTrace();
> }
> }
> }
>
> 4) when I try to compile, I get the following error message:
> % javac PrettyPrinter.java
> PrettyPrinter.java:15: cannot access org.xml.sax.InputSource
> file org/xml/sax/InputSource.class not found
> Document doc = builder.build(new File(filename));
> ^
> 1 error
>
> Any clue as to what I am doing wrong?
>
> Thanks in advance,
>
> BobT
More information about the jdom-interest
mailing list