sab669
sab669

Reputation: 4104

How do you import and use existing libraries in Eclipse?

I'm Visual Studios / C#, you can simply add a reference to a DLL file and then just use that namespace. I'm starting to dig into Android development and want to use the SimpleFTP library. Downloaded the .jar file, went to File --> Import and now I've got SimpleFTP.class and SimpleFTP.java in org\jibble\simpleftp in my Package Explorer.

But if I try to import org.jibble.simpleftp; it says it cannot be resolved. What have I done wrong?

enter image description here

I was hoping I could just start typing as if I had properly imported the library and it'd figure out how to correct my package, but no such luck =[

Upvotes: 0

Views: 362

Answers (3)

Code-Apprentice
Code-Apprentice

Reputation: 83587

There are at least three solutions:

  1. If you have the source code, you can place it under your src folder directly in your project.

  2. If you have the source code, you can create an Android Library Project with the source code and connect your Android app projec to the library project.

  3. If you have a JAR file, you can place it in the libs folder of your proejct.

Upvotes: 2

ItayB
ItayB

Reputation: 11367

Right click on your project and add build path

Upvotes: 0

nKn
nKn

Reputation: 13761

Project -> Properties -> Java Path -> Libraries. There you can add your existing libraries, in several formats (jar, .zip, etc.).

Upvotes: 0

Related Questions