Home > Java > javaTutorial > body text

How to import packages in java?

青灯夜游
Release: 2019-11-16 16:55:18
Original
14383 people have browsed it

When you import certain packages into a java class (for example: import javax.servet.*), an error will be reported, indicating that this package does not exist. That's because the JRE System Library of the jdk we use does not contain servet_api.jar.

How to import packages in java?

At this time we can download the required servlet-api.jar from the Internet or from the Tomcat lib subdirectory. So, how to import the corresponding jar package into the java project? Below we will explain the steps of

java import package

1. First, create a new folder under the project to save the jar package. Right-click on the project name, click [New] → [Floder] in sequence to open the window for creating a new folder

How to import packages in java?

2. Enter the folder name [lib], Click [ok]. Jar packages imported from outside are usually stored in the lib folder

How to import packages in java?

#3. Find the jar package to be imported, select the jar package you want to use with the mouse, and then hold down the left mouse button Without releasing the key, drag the jar package to the lib folder. Or copy the jar package first, then right-click on the lib folder and select copy. Open the selection box, select the default [copy files] in the pop-up selection box, and click [OK] to close. Then you can see the successfully copied jar package in the lib folder.

How to import packages in java?

How to import packages in java?

4. At this time, just copy the jar package to the project, but it cannot be used yet. You need to right-click on the project name and select

[Build Path]→[Configure Build Path...] in order.

How to import packages in java?

5. In the opened window, select the [Libraries] page and click [add JARs...] from the button in the right column

How to import packages in java?

6. In the opened window, expand the project and lib folder in order, then select the jar package just copied to the project, and click [OK] to close the window

How to import packages in java?

7. In the [Libraries] page just opened, you can see the name of the jar package just introduced. Click [OK] to confirm.

How to import packages in java?

8. At this time, in [Eclipse], you can find and start using this jar package.

How to import packages in java?

The above is the detailed content of How to import packages in java?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!