IDEA marks the java project into an executable jar package

  1. Shift+ Ctrl+ Alt+ sOpen the following window, select Artifacts:
    Insert picture description here
    DBUtil here is the jar package I used for testing, it should be nothing normally

  2. In the picture above, I found the +number above the DBUtil test . Click it! Then select JAR->From modules with dependencies...
    Insert picture description here

  3. In Main-Classthe input method Main inlet class (where the main function class). You can choose from the icons of the following folders.

The path below indicates the location of the META-INFO file required by the component jar package . Can be changed

If there is more than one module under your project and only one module is exported this time, Modulechange it at
Insert picture description here
4. Next, you can change the name, storage path and other information of the jar package on the right. Then if the program has a dependency package, +click it at the bottom of this picture !
Insert picture description here
5. Select the first item: Library Files
Insert picture description here
6. Select the external jar package you need, Apply-> OKyou can generate the files needed to export the jar package

  1. Next, export the jar package, go back to the main IDEA window, and find it in the top toolbar Build:
    Insert picture description here
  2. Select the package name you just created -> build:
    Insert picture description here
    Wait for IDEA to form. After the end, you can find the jar package in the file path configured in step 4

Guess you like

Origin blog.csdn.net/weixin_44559752/article/details/106662312
Recommended