I'm a bit new to eclipse and want to use the following libraries so that I can use their implemented objects (HttpClient and Java csv). How do I import these libraries so that I can write some java with them?
http://hc.apache.org/downloads.cgi
http://sourceforge.net/projects/javacsv/
What you're looking to do is add the libraries to your project's build path (the class path that will be used while compiling). In Eclipse, you can do this by right-clicking your project and choosing Properties
(or hitting [Alt]+[Enter]
when the project is selected in Project Explorer
, Navigator
or Package Explorer
views) and then Java Build Path
from the sidebar and the Libraries
tab where you can add JARs.
Note the difference between Add JARs
and External JARs
is that External JARs
will add an external dependency in your project since the absolute path to the JAR on your filesystem will be put into your project's configuration. With Add JARs
you can select JARs from within your workspace.
I find it to be a good practice to create a lib
folder (at the same level as my src
folder) and put all my JARs in there and then add them to the build path with the Add JARs
option. This makes the project portable since there are only relative paths referring to resources within the project rather than absolute paths or resources from other workspace projects.
You add the .jar files you want to use in your projects build path. You access this windows by right-clicking your project. Choosing "Build path" -> "Configure build path".