How to make idea into a jar package and turn it into an executable exe file

How to make idea into a jar package and turn it into an executable exe file

1. Use Artifacts in idea to select the main method class to be packaged.
Insert image description here
2. Use build to create a jar package
Insert image description here
. Finally we will get a .jar program.

We can use java -jar XXX.jar to run this jar package locally.
But if other computers do not have jdk installed, they cannot run it. What should I do?

3. We use the exe4j tool to turn the produced XXX.jar package into a XXX.exe file. We can directly click to run and
use exe4j to download directly.
You can learn from this:
https://blog.csdn.net/mawei7510/article /details/89675034

Finally, the produced jar will be turned into an .exe file.
Note: The production of exe files actually still requires jre. You only need to copy the jre to the same directory as the exe file. If you need a configuration file, you need to copy the configuration file as well. Click Just run it directly.
Insert image description here
As shown in the picture above:
Click the Test.exe file and it will run directly. You only need to send the configuration and jre directly to other systems. Other systems do not need to install jdk and can also run the program directly for display.

Guess you like

Origin blog.csdn.net/rainAndyou/article/details/116043626