Nidale
Nidale

Reputation: 69

project classpath in eclipse

I have a question about adding folder/jars/libraries to a project in eclipse.

Let's say i download a folder off the internet which has libraries, do I add it as a folder, external jar or a class folder ?

Either way, I added it and it is now part of the libraries available, but I still get an error in my program saying the class is not available.

I then tried to modify $CLASSPATH to where the folders are sitting and I'm still getting errors.

What am I doing wrong ?

Upvotes: 1

Views: 486

Answers (2)

Ashutosh Jindal
Ashutosh Jindal

Reputation: 18869

After adding all the JARs , try pressing Ctrl + Shift + O (as in Orange). This should re-organize the Imports and try to add any missing ones.

For example, go to excelToText.java and press Ctrl + Shift + O OR Click Source -> Organize Imports like so :

enter image description here

Then when you Save the file ( File -> Save) do you see the Errors disappear ?

See this video to take a look at how this works.

Upvotes: 1

Larry
Larry

Reputation: 11899

Simply try the following (if your project is a web-application):

  • Add your libraries (I presume jar files) to your WebContent/WEB-INF/lib folder. What you can do is simply copy the jar (i.e. Ctrl+C) and then past into this Eclipse folder. In this manner, the library will automatically be added to the build-path.

Alternatively, you can follow any of the three-steps outlined in this example: http://www.wikihow.com/Add-JARs-to-Project-Build-Paths-in-Eclipse-(Java)

I would personally try Method-3 first (which is exactly what I mentioned in the comment provided below).

If this does not work, please try add more specifics to your question. For example, which library did you download (it might help to mention in case you’re missing something we don’t know about). Also, what exactly are the errors you are getting? If you cannot post an image, simply copy what the error is.

Upvotes: 2

Related Questions