After three days of separation, treat each other with admiration. ——"Three Kingdoms"
In order to encapsulate a java program into a simple and easy-to-use tool, use the bat script to start the jar package.
In the txt document, type:
@echo off
java -jar %~dp0core\demo.jar
Note:
1. "core" is the name of the folder, and the ultimate goal is to specify the jar package as an absolute path.
2. %~dp0 obtains the absolute path of the folder where the current bat is located.
After saving the txt, change it to bat suffix to run the jar package
To facilitate debugging, the script can be modified into the following format:
@echo off echo %~dp0 java -jar %~dp0core\demo.jar pause
Note:
1. "echo %~dp0" outputs the current absolute path on the cmd window.
2. "Pause" means not to exit automatically after running, so that you can see the cmd print information.