开发者

a simple question about lib folder in Eclipse

开发者 https://www.devze.com 2023-01-29 17:51 出处:网络
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 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 "th开发者_运维问答e 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!


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


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


Add the library to your build path.

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

Libraries --> Add jar


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消