Importing jdom to eclipse project

user2974665 picture user2974665 · Nov 9, 2013 · Viewed 8.7k times · Source

I am trying to use the jdom 2.0.5 library and I have gone through the steps of importing it and configuring the build path but when I attempt to import the libraries I get an error saying "the import cannot be resolved"

Answer

A4L picture A4L · Nov 9, 2013

"the import cannot be resolved"

means either you have a misspelling somewhere in the import directive or you haven't configured the build path correctly. If you have, then after using a jdom Class in your code organize the import using Ctrl-Shift+o. If you haven't then configure your class path correctly by one of the following methods:

  1. Download jdom2 jars and save them somewhere. Configure your build path as described here.

  2. Convert your project to a maven project and add the following dependency in the pom.xml file:

    <dependency>
        <groupId>org.jdom</groupId>
        <artifactId>jdom2</artifactId>
        <version>2.0.5</version>
    </dependency>