In this topic, we will learn how to add an external library file (.jar) to a Java project in Eclipse. An external library file could be:
- a driver to connect to a database, for example: mysql connector driver
- some library files of a third party provider, ex. hibernate, struts, spring libraries...
- one of your functions that has been coded in previous project and now, you would like to reuse it.
So now, let follow these steps to add an external library file (.jar) to a Java project in Eclipse:
Step 1: Being aware of the path to your external library file (.jar)
Step 2: Go to your project in Eclipse environment
Step 3: Right click on the lowest item under your project -> choose the menu "Build path" -> choose "Configure Build Path"
Step 4: A child window will be appeared
Step 5: Click ion the second button on the right side: "Add External JARs" -> a path Finder will be appeared:
Step 6: point out the path to your external library file (.jar) -> select all necessary files -> click Ok until all selected files appear under the item "JRE system library" of your project
Now you could use these lib files as if they are a part of your current project!
I think using apache maven is better. Because it auto download library when we add.
ReplyDeleteYes! It is another solution! ;)
DeleteBut It is not better for beginner, I think! ;)