Setting the classpath in java using Eclipse IDE
Asked Answered
F

3

9

I have an Eclipse project with an external folder containing a lot of JAR files (legacy libraries) . instead of adding all the jars in Eclipse ("add external Jar"), I would prefer to add a ref to this external folder. In the "configure build bath", I'm adding a "External Class Folder". If I'm doing that instead of adding the Jar, my program is not compiling anymore. Am I missing something on the way I should use this option ?

Thanks

Footton answered 28/2, 2011 at 15:56 Comment(2)
What do you mean by "it's not compiling anymore"?Canaille
Just add those jar files in your build path and will be referenced when you compile your program.Ulrike
N
8

Try this:

Project -> Properties -> Java Build Path -> Add Class Folder.

If it doesnt work, please be specific in what way your compilation fails, specifically post the error messages Eclipse returns, and i will know what to do about it.

Nolan answered 28/2, 2011 at 16:10 Comment(0)
J
7

You can create new User library,

On

"Configure Build Paths" page -> Add Library -> User Library (on list) -> User Libraries Button (rigth side of page)

and create your library and (add Jars buttons) include your specific Jars.

I hope this can help you.

Jacobin answered 28/2, 2011 at 16:5 Comment(1)
That is my recommended resolution as well. The only thing that I would add to this answer is to clarify that a classes directory is a directory of .class file. Any jars contained in that directory will not be looked at.Velazquez
K
1

Just had the same issue, for those having the same one it may be that you put the library on the modulepath rather than the classpath while adding it to your project

Krysta answered 12/2, 2021 at 23:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.