17.1. Adding a library (.jar) to your project
The following describes how to add Java libraries to your project. Java libraries are distributed via "jar" files. It assumes that you have a jar file available; if not feel free to skip this step.
Create a new Java project
de.vogella.eclipse.ide.jars
. Then, create a new folder called lib
, by right clicking on your project and selecting → .
From the menu select
→ → → . Select your jar and select the lib
folder as target. Alternatively, just copy and paste your jar
file into the lib
folder.Right click on your project and select Properties. Under → select the button.
The following example shows how the result would look like, if the
(Or simply add External JARs - one step)
junit-4.4.jar
file had been added to the project.(Or simply add External JARs - one step)
Afterwards you can use the classes contained in the
jar
file in your Java source code.
Adding JDBC lib into project
没有import jdbc lib会出现classNotFoundException
MySQL Command Line Client
Add the lib into your project: EX: Servlet framework; JDBC Driver
- Right-click the project, click Properties.
- Choose Java Build Path.
- Click Add JARs...
- Find
servlet-api.jar
in your project and select it. - Click OK to update the build path.
No comments:
Post a Comment