Kevin
Kevin

Reputation: 6831

a simple question about lib folder in Eclipse

I am new to Eclipse IDE, I created a new project named "Hello World", and I need some APIs which are contained in a jar file.

I created a folder called "lib" under the project folder "Hello World" (parallel with src folder), and I import the .jar file into this lib folder, it extracts all the things to this lib folder automatically.

Then I created my HelloWorld.java class under src folder, however, when I put import ro.xxx.xxx.xxx, eclipse complains "the import ro cannot be resolved". Actually, the ro is under the lib folder.

I am stuck here. Shall I make this lib folder under the src folder instead of parallel with it? Please kindly give me some suggestions, thanks in advance!

Upvotes: 7

Views: 57680

Answers (4)

Squidious
Squidious

Reputation: 21

After you first create the lib folder parallel to the src folder you need to go back into Eclipse and Refresh the project so that Eclipse finds the new folder and jars. You can either highlight the project and hit F5, or use the right click menu off the project. After that the lib folder and jar files appear and you can right click a jar to add to the build path. If you add new jars subsequently you need to refresh again for Eclipse to find them.

Upvotes: 0

Jigar Joshi
Jigar Joshi

Reputation: 240996

Just Putting jar in lib folder won't work , you need those jars in your class path.

Here it is described how to add jars in to your build path in eclipse

Upvotes: 4

Stan Kurilin
Stan Kurilin

Reputation: 15812

Project -> properties -> Java build path -> libraries -> add external jars

Upvotes: 17

Mark Baijens
Mark Baijens

Reputation: 13222

Add the library to your build path.

Right mouse button on your project --> Build Path --> Configure Build Path...

Libraries --> Add jar

Upvotes: 2

Related Questions