简体   繁体   中英

how to define jar files and libraries in eclipse indigo?

I am trying to compile a java project which makes uses of android libraries. The project I am using is checked out from a svn repository. In order to take a use of that project I am required to define some jar files and libraries for that project. Here are the files that I need to make sure they are defined:

•"lib/apache-mime4j-0.4.jar" : Jar 
•"lib/httpmime-4.0-beta1.jar" : Jar 
•"lib/slf4j-android-1.5.8.jar" : Jar 
•"JUnit 4.libraryclasspath" : Library 
•"ANDROID_SDK_PLATFORM/android.jar" : var 
•"Java JRE System Library" : Library 

Does anyone have any idea about what should I do to define these files? I am a noob here.I do not know which selection should I choose When I clicked "project -> properties -> java build path -> libraries" For example if I want to define the first jar file, there are a "add external jar" and a "add libraries" selections. However you can see a "lib" here in front of the "apache-mime4j0.4.jar file" in this list above.. So I don't understand if it is asking me to add a jar file or the librabry.. I am getting very confused about this. And also How can I do anything with "JUnit 4.libraryclasspath" file? I think it is a classpath file so I cannot either choose "add jar files" or "add libraries" to define it.. Hope someone has any knowledge about this and I will be very appreciated!

I think You are unable to include the files due to SVN path but will discuss it later.At first we look how to add jar files
Right click on your project in which you want to add the jars
1.select build path and then "configure build path"
2.click on "Libraries" tab
3.Now click on Add external jars (as your all jars files would be placed in some directory outside the project folder or anywhere else)
4.Select these jars and now do OK ... Now these jars are in your class path and you can use these files.
Now another thing, As You told that you are using svn , It means many of other developers are also using the same project then it is compulsory that all of you have same path of jars in your systems for instance in Dev1 PC the jar if the jar file is placed in d:/lib/jars folder then all other DEV2 , DEV3 ... DEVn must have d:/lib/jars folder and their jars must be placed there and you have to add these jars from d:/libs/jars
Last thing , If you are still unable to understand the solution and remove the bugs then simply do this.
Copy all jar files manually (ctrl+c) and copy to lib folder in your project as i have seen that in your project the person who commits the code place them there.
after then , right click on your project and click refresh(as it is bad practice to put jar files in project by creating folder like lib etc unless it is a web project)
Let me know if anything is unclear about this

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM