JDOM Classpath Help Required


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 6 of 6

Thread: JDOM Classpath Help Required

Threaded View

  1. #1
    Join Date
    Jan 2006
    Location
    London
    Posts
    11

    JDOM Errors Help Required

    Hi Guys,

    I am trying to follow an example using JDOM, which will write, update delete an XML file.

    I thought I had set the JDOM & Xerces classpaths correctly, but I'm guessing not now:

    I had one error in my java file as follows:

    C:\Tomcat 5.5\webapps\ROOT\XMLEdit>javac CATALOGManager.java
    CATALOGManager.java:81: illegal escape character
    FileWriter f = new FileWriter(new File("C:\\Tomcat 5.5\\webapps\\ROOT\\X
    MLEdit\CATALOG1.xml"));
    ^
    1 error

    So I forgot the extra '\' in the path. Not a problem.

    When I then went onto compile the java file thinking all was ok, I got the following errors:

    C:\Tomcat 5.5\webapps\ROOT\XMLEdit>javac CATALOGManager.java
    CATALOGManager.java:3: package org.jdom does not exist
    import org.jdom.*;
    ^
    CATALOGManager.java:4: package org.jdom.output does not exist
    import org.jdom.output.XMLOutputter;
    ^
    CATALOGManager.java:6: package org.jdom.input does not exist
    import org.jdom.input.*;
    ^
    CATALOGManager.java:7: package org.jdom.output does not exist
    import org.jdom.output.*;
    ^
    CATALOGManager.java:12: cannot find symbol
    symbol : class Document
    location: class XMLEdit.CATALOGManager
    Document docs;
    ^
    CATALOGManager.java:18: cannot find symbol
    symbol : class SAXBuilder
    location: class XMLEdit.CATALOGManager
    SAXBuilder builder = new SAXBuilder();
    ^
    CATALOGManager.java:18: cannot find symbol
    symbol : class SAXBuilder
    location: class XMLEdit.CATALOGManager
    SAXBuilder builder = new SAXBuilder();
    ^
    CATALOGManager.java:19: cannot find symbol
    symbol : variable doc
    location: class XMLEdit.CATALOGManager
    doc = builder.build(filename);
    ^
    CATALOGManager.java:20: cannot find symbol
    symbol : variable doc
    location: class XMLEdit.CATALOGManager
    product = doc.getRootElement().getChildren();
    ^
    CATALOGManager.java:21: cannot find symbol
    symbol : class JDOMException
    location: class XMLEdit.CATALOGManager
    } catch (JDOMException e) {
    ^
    CATALOGManager.java:36: cannot find symbol
    symbol : class Element
    location: class XMLEdit.CATALOGManager
    Element product = (Element)product.get(index);
    ^
    CATALOGManager.java:36: cannot find symbol
    symbol : class Element
    location: class XMLEdit.CATALOGManager
    Element product = (Element)product.get(index);
    ^
    CATALOGManager.java:41: cannot find symbol
    symbol : class Element
    location: class XMLEdit.CATALOGManager
    Element product = (Element)product.get(index);
    ^
    CATALOGManager.java:41: cannot find symbol
    symbol : class Element
    location: class XMLEdit.CATALOGManager
    Element product = (Element)product.get(index);
    ^
    CATALOGManager.java:47: cannot find symbol
    symbol : class Element
    location: class XMLEdit.CATALOGManager
    Element product = (Element)product.get(index);
    ^
    CATALOGManager.java:47: cannot find symbol
    symbol : class Element
    location: class XMLEdit.CATALOGManager
    Element product = (Element)product.get(index);
    ^
    CATALOGManager.java:53: cannot find symbol
    symbol : class Element
    location: class XMLEdit.CATALOGManager
    Element product = (Element)product.get(index);
    ^
    CATALOGManager.java:53: cannot find symbol
    symbol : class Element
    location: class XMLEdit.CATALOGManager
    Element product = (Element)product.get(index);
    ^
    CATALOGManager.java:60: cannot find symbol
    symbol : variable products
    location: class XMLEdit.CATALOGManager
    products.remove(index);
    ^
    CATALOGManager.java:64: cannot find symbol
    symbol : class Element
    location: class XMLEdit.CATALOGManager
    Element product = new Element("product");
    ^
    CATALOGManager.java:64: cannot find symbol
    symbol : class Element
    location: class XMLEdit.CATALOGManager
    Element product = new Element("product");
    ^
    CATALOGManager.java:65: cannot find symbol
    symbol : class Attribute
    location: class XMLEdit.CATALOGManager
    product.setAttribute(new Attribute("id", id));
    ^
    CATALOGManager.java:66: cannot find symbol
    symbol : class Element
    location: class XMLEdit.CATALOGManager
    product.addContent(new Element("name").setText(name));
    ^
    CATALOGManager.java:67: cannot find symbol
    symbol : class Element
    location: class XMLEdit.CATALOGManager
    product.addContent(new Element("price").setText(price));
    ^
    CATALOGManager.java:73: cannot find symbol
    symbol : class Sortname
    location: class XMLEdit.CATALOGManager
    catalog.sort(product, new Sortname());
    ^
    CATALOGManager.java:73: cannot find symbol
    symbol : variable catalog
    location: class XMLEdit.CATALOGManager
    catalog.sort(product, new Sortname());
    ^
    CATALOGManager.java:78: cannot find symbol
    symbol : variable XMLOutputter
    location: class XMLEdit.CATALOGManager
    XMLOutputter.output(" ",true);
    ^
    CATALOGManager.java:80: cannot find symbol
    symbol : variable outputter
    location: class XMLEdit.CATALOGManager
    outputter.setTextNormalize(true);
    ^
    CATALOGManager.java:81: cannot find symbol
    symbol : class FileWriter
    location: class XMLEdit.CATALOGManager
    FileWriter f = new FileWriter(new File("C:\\Tomcat 5.5\\webapps\\ROOT\\X
    MLEdit\\CATALOG1.xml"));
    ^
    CATALOGManager.java:81: cannot find symbol
    symbol : class FileWriter
    location: class XMLEdit.CATALOGManager
    FileWriter f = new FileWriter(new File("C:\\Tomcat 5.5\\webapps\\ROOT\\X
    MLEdit\\CATALOG1.xml"));
    ^
    CATALOGManager.java:81: cannot find symbol
    symbol : class File
    location: class XMLEdit.CATALOGManager
    FileWriter f = new FileWriter(new File("C:\\Tomcat 5.5\\webapps\\ROOT\\X
    MLEdit\\CATALOG1.xml"));
    ^
    CATALOGManager.java:82: cannot find symbol
    symbol : variable doc
    location: class XMLEdit.CATALOGManager
    outputter.output(doc, f);
    ^
    CATALOGManager.java:82: cannot find symbol
    symbol : variable outputter
    location: class XMLEdit.CATALOGManager
    outputter.output(doc, f);
    ^
    CATALOGManager.java:104: cannot find symbol
    symbol : method setIndex(int)
    location: class XMLEdit.CATALOGManager
    d.setIndex(i);
    ^
    CATALOGManager.java:111: cannot find symbol
    symbol : class XMLOutputter
    location: class XMLEdit.CATALOGManager
    XMLOutputter outputter = new XMLOutputter();
    ^
    CATALOGManager.java:111: cannot find symbol
    symbol : class XMLOutputter
    location: class XMLEdit.CATALOGManager
    XMLOutputter outputter = new XMLOutputter();
    ^
    CATALOGManager.java:113: cannot find symbol
    symbol : variable doc
    location: class XMLEdit.CATALOGManager
    outputter.output(doc, System.out);
    ^
    37 errors

    Which I cant understand. Could someone helpout setting the classpath for JDOM. As I have put the JDOM & Xerces jar files in my classpath and set the path as follows (using the environment variable in Windows):

    C:\Program Files\Java\jdk1.5.0_02\bin;.;C:\Program Files\Java\jdk1.5.0_02\lib\jdom.jar; C:\Program Files\Java\jdk1.5.0_02\lib\xerces.jar"C:\Tomcat 5.5\common\lib\servlet-api.jar";"C:\Tomcat 5.5\common\lib\jsp-api.jar";"C:\Tomcat 5.5\common\lib\catalina-root.jar";"C:\Tomcat 5.5\common\lib\jdom.jar";"C:\Tomcat 5.5\common\lib\xerces.jar"

    Is this incorrect? Is this what the errors are referring to?
    Any Help much appreciated.
    Last edited by kpandya; 01-15-2006 at 07:12 PM.

Similar Threads

  1. Replies: 1
    Last Post: 09-07-2001, 03:03 PM
  2. Replies: 1
    Last Post: 09-07-2001, 03:03 PM
  3. JDOM and appending a child element
    By David Rancour in forum Java
    Replies: 1
    Last Post: 08-01-2001, 10:58 AM
  4. typical problem, pls help
    By SATISH in forum Java
    Replies: 1
    Last Post: 09-29-2000, 09:33 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center