Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
211 views
in Technique[技术] by (71.8m points)

java - Adding folder to Eclipse classpath

While developing a Java project, I place all of my jar files in a folder, created within my project, called libs. Now, is there a way to add my libs folder to the Java class path so that I do not have to add each individual jar?

I was thinking something along the lines of a variable or creating a user library.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Based on what you've said, I would probably create a user library containing your library JARs.

You can create a User Library with Window => Preferences, drill down to Java => Build Path => User Libraries. => Then choose New, and give your library a name => Then add the JARs you want.

Then you can add all the JARs to the classpath of any project you have by right-clicking on the project => Add Libraries => User Libraries, and selecting your library.


Update; to have Eclipse dynamically add .jar files you drop into a folder to your project classpath, you need a plugin called Library Folder ClasspathContainer. Follow these instructions and you're in business.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...