Paul
Paul

Reputation: 4860

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.

Upvotes: 35

Views: 23913

Answers (1)

brabster
brabster

Reputation: 43600

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.

Upvotes: 35

Related Questions