background:
The compiled code wants to be used on other windows computers, but the other party may not be a professional, and it is difficult to use IDEA, so a simple startup method is needed.
The operating conditions of the other computer:
1. Install the Java virtual machine (skip, search for a lot of tutorials)
2. Copy the executable Jar package to the computer
The computer generates the Jar package operation steps:
1. Write SpringBoot application on Idea
According to specific scenarios, write your own
2. Execute "File / Project Structure..."
3. Create new Artifacts
4. Set the jar configuration
illustrate:
Main Class: Springboot startup class
Jar files from libraries: The second item is to separate the application jar package from the dependent package and put them in the same folder
The location of the MANIFEST.MF file: can be configured at will
5. Adjust the Jar package name and output location
6. Build the Jar package
7. Execute the Jar package
Enter the location of the Jar package, open the cmd page, and execute: java -jar control-toolkit.jar to start the service
Explanation: The project package and the dependent package are in the same folder, and the eyes should be good
Implementation improvements:
Because the way to start using the command is a bit complicated, and the startup package and the dependent package are all together, it is difficult to find, so optimize the startup method.
1. Create two folders
2. Create a start.bat file in the bin folder
The content of the start.bat file is as follows
@echo off
java -Xms256m -Xmx1024m -jar ../lib/control-toolkit.jar
@echo . & pause
3. Double-click the bat file to start the application
This method is more friendly and convenient to use