Naturia Rock
Naturia Rock

Reputation: 75

java import error, org.jdom

ive been trying to do an import in my java project but i keep getting the following error.

The import org.jdom cannot be resolved

i have created a lib folder under my project and have put the jar files from http://www.jdom.org/downloads/index.html

into there. there were a total of 8 different jar files which i added. then i added them in my build path. those 8 files are now in my referenced libraries. however that error keeps coming up. ive tried refreshing and cleaning my project but no luck.

am i supposed to do something different since its a org.jdom?

my import statements are...

import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;
import org.jdom.output.Format;
import org.jdom.output.XMLOutputter;

thank you

Upvotes: 2

Views: 20781

Answers (4)

Vivek Vermani
Vivek Vermani

Reputation: 2014

Could be because of the package rename in later versions. The later version shows the package name as dom2 instead of dom.

Upvotes: 0

Tell Me How
Tell Me How

Reputation: 570

You should import jdom-1.1.3 which is stable and work for me.

Upvotes: 1

lory105
lory105

Reputation: 6312

It depends from the library version!!

If you downloaded the version 1 you MUST write:

import org.jdom.*

If you downloaded the version 2 you MUST write:

import org.jdom2.*

Upvotes: 3

Peter
Peter

Reputation: 679

I opened the jar file at the link you gave using 7zip. It looks like you will need to use the import statements: (Note the addition of the '2') "import org.jdom2.Document;"

Upvotes: 7

Related Questions