Writing a batch file to launch Java program is relatively easy. It is useful if you need to console output something.
- Create a new Text File
- Type in following code :
java -jar "YOUR JAVA PROGRAM NAME.jar"
- Change the file extension from “.txt” to “.bat”
Here’s how to change file extension: