DanielTheRocketMan
DanielTheRocketMan

Reputation: 3249

import library to eclipse

I have been trying for hours to import a library to Eclipse. I tried the simplest method that seems to be to copy the folders inside a lib folder inside the project in Eclipse.

Inside the project folder, the folder of the library is lib/org/imgscalr

I am using the code

import static org.imgscalr.*;

What am I doing wrong? I dont know if there is any difference, but I am using a MACBOOK.

I'd like to say that I used the " refresh" and I can see the folder and files there...

Upvotes: 2

Views: 994

Answers (1)

Javier
Javier

Reputation: 12408

If your library is a jar file, then right click the project name and navigate to Build Path. Select Configure Build Path, and there the Libraries tab. Then choose "Add JAR" or "Add external JAR"(see here and here). The difference between these options is that "Add JAR" is for jars in the project directory, while "Add external JAR" allows for JARs locates anywhere else.

If your "library" is in the form of a folder with classes, follow the steps above but choose "Add Class Folder" instead of "Add JAR".

Upvotes: 3

Related Questions