I am trying to compile the following program :
import org.jdom.*;
import org.jdom.output.XMLOutputter;
public class example2a
{
public static void main(String[] args)
{
Element root = new Element("myRootElement");
Document doc = new Document(root);
root.setText("This is a root element");
System.out.println(doc);
}
}
The errors I am getting are :
example2a.java:1: package
org.jdom does not exist
import org.jdom.*;
^
example2a.java:2: package org.jdom.output does not exist
import org.jdom.output.XMLOutputter;
^
example2a.java:7: cannot find symbol
symbol : class Element
location: class example2a
Element root = new Element("myRootElement");
^
example2a.java:7: cannot find symbol
symbol : class Element
location: class example2a
Element root = new Element("myRootElement");
^
example2a.java:8: cannot find symbol
symbol : class Document
location: class example2a
Document doc = new Document(root);
^
example2a.java:8: cannot find symbol
symbol : class Document
location: class example2a
Document doc = new Document(root);
^
6 errors
I have included the "jdom.jar" file in the classpath as you had told me, Justin.
On 11/28/06, Justin Edelson <
justinedelson@gmail.com> wrote:>I tried to use the build command and it created a "classes" and "src" folder.
This compiled JDOM. Unless you've made changes to the JDOM source code, there's really no reason to do this. There should be a jdom.jar file in the build directory already. This jar is what should be added to your classpath.
> Kindly tell me what I have to do next ?
It's a little hard to tell you what you have to do next since you haven't told us what it is you're trying to do.
On 11/28/06,
Anshul Saxena <anshulacxiom@gmail.com> wrote:
Hi Justin,
Thanks for your prompt response!
I am new to both jdom and java so please forgive my asking trivial questions.
I downloaded and extracted the Jdom-1.0 as you had suggested.
I see the following folders there :
build
etc
lib
package
samples
src
build.bat
build.sh
build.xml
CHANGES.txt
COMMITTERS.txt
LICENSE.txt
README.txt
TODO.txt
I tried to use the build command and it created a "classes" and "src" folder.
Kindly tell me what I have to do next ?
Waiting for a reply!
Regards
On 11/28/06, Justin Edelson
<
justinedelson@gmail.com> wrote:You're not including jdom.jar in your classpath. Is there a reason you need to use the beta version? JDOM
1.0 is over two years old now.
And... I don't know why you're referencing jaxp.jar in the first place. Both b10 and
1.0 contain a jar called xml-apis.jar. If you're using Java 1.5 (or 1.4 for that matter), you dont't need xml-apis.jar or xerces.jar. If you're not using JDOM's XPath classes, all you need is %JDOM_HOME%\build\jdom.jar, assuming JDOM_HOME is set to where you unzipped the
jdom-1.0.zip file.
I am getting the above error although my class path settings are :
CLASSPATH:
.;C:\Program Files\Java\jre1.5.0_06\lib\ext\QTJava.zip;C:\java\jdom-b10\build;%JDOM_HOME%\build\classes;
%JAVA_HOME%\lib\tools.jar;%JDOM_HOME%\lib\xerces.jar;%JDOM_HOME%\lib\jaxp.jar
JAVA_HOME : C:\Program Files\Java\jdk1.5.0_09
JDOM_HOME: C:\java\jdom-b10
I cannot see any "jaxp.jar" file in the jdom folder. Is this the cause for the error. If it is, then how can i get this file. I don't think it comes with the current version of jdom-b10.
Kindly reply ASAP.
Regards
_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com