How to import jar packages in Java projects: 1. Create a new folder lib in the java project, and copy the jar packages that need to be imported to the lib folder; 2. Select the jar in the lib folder package, right-click [Build Path] → [Add to Build Path].
When we are doing Java programming, sometimes the required jar package itself does not exist. How to add and import the jar?
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. At this time, we can download the required servlet-api.jar from the Internet or from the lib subdirectory of Tomcat. So, how to import the corresponding jar package into the java project? Below we will explain the
recommended courses: Java Tutorial.
Step one: Create a new folder lib in the java project, and copy the jar package that needs to be imported into the lib folder.
#The second step is to select servlet-api .jar, right-click [Build Path] → [Add to Build Path] and then the jar package has been successfully added to the java project. At this time, there is an additional Referenced Libraries library in your java project, and inside this library is the successfully added servlet-api.jar package.
The above is the detailed content of How to import jar package into Java project?. For more information, please follow other related articles on the PHP Chinese website!