Get the App
SLTechnology News&Howtos  ›  Development  › 

How does the java project introduce other jar packages

Shulou Source: shulou.com Published: 2022-06-03 07:10:28 11月15日 Update

This article mainly introduces the java project how to introduce other jar packages, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

Tools.jar is a newly typed toolkit, now import it into the project.

Step 1 lib directory

Basically every java project has a lib directory. We create this directory and throw the jar package into it.

The purpose of the lib directory is to store third-party jar packages.

Step 2 modify the compilation script

Mkdir classesjavac-classpath.; D:\ java18\ cstmgr;D:\ java18\ cstmgr\ lib\ tools.jar-d D:\ java18\ cstmgr\ classes * .javajavac-classpath.; D:\ java18\ cstmgr;D:\ java18\ cstmgr\ lib\ tools.jar-d D:\ java18\ cstmgr\ classes entity\ * .javapause

Instead of compiling the java class in the tool folder, just add the jar package to classpath.

Step 3 compile the cstmgr project

Step 4 New mode of operation

When we come to the classes folder, we need to change the operation mode. One more step is to add the path of the jar package. Note that the path of the jar package needs to end with * *; * *.

-cp is the path where the jar package is introduced.

Step 5: mkdir classesjavac-classpath.; D:\ java18\ cstmgr;D:\ java18\ cstmgr\ lib\ tools.jar-d D:\ java18\ cstmgr\ classes * .javajavac-classpath.; D:\ java18\ cstmgr;D:\ java18\ cstmgr\ lib\ tools.jar-d D:\ java18\ cstmgr\ classes entity\ *. Javacd classesjava-cp D:\ java18\ cstmgr\ lib\ tools.jar; Applicationpause

Rerun.

Thank you for reading this article carefully. I hope the article "how to introduce other jar packages into java Project" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and follow the industry information channel. More related knowledge is waiting for you to learn!

Tags: Steps projects directories articles compilations paths runs files folders ways values roles interests and at the same time tools toolkits more friends knowledge Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Huawei MariaDB Apple Microsoft