Cannot resolve import org.dom4j.*
I am working o开发者_JAVA百科n a servlet/java project in eclipse, and one of the java files contains methods from the dom4j library. However the library import cannot be resolved
import org.dom4j.*;
import org.dom4j.io.SAXReader;
I added dom4j library (org.dom4j.feature.group
) through eclipse's Install New Software option but import. I noticed that org.dom4j
is not listed as a jar file in the Referenced Libraries subfolder. What would be the proper way to add this library to the project so that it could be resolved?
- Right click on your project
- then click on Configure Build Path
- On the window, click on the button Add external Jars
- Browse to the jar that contain org.dom4j* classes
If you added the jar yourselves, then just right click on that jar in project explorer and then click -> Configure build path -> Add to build path.
This page help me add external library in eclipse and in this page we can download the library download library
- Right-click in the project and go to properties
- Select "Java Build Path" on the left, and then the "Libraries" tab. Now, click the "Add External JARS..." button
- Locate and select the "xXx.jar" file you just downloaded, and then click "Open"
- Finally, click "OK" to close the dialog box. You will know that everything went ok if, when you open your project folder, you see an item called "Referenced Libraries", and upon expanding this item, you see the package "xXx.jar" listed.
精彩评论