Launching Java Programs with Batch File (Console Display)

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:


[Java] GUI Console Output

Normally, if you write an application, to get the console output, you need to either load it in command propmt or write a batch file to have the Jar file launched with the command prompt window. This method might not work at some locations (ie. Comapny Shared Folder).

To solve this problem, we can create out own Output window in Java, and redirect  System.out to that window by overriding the methods.

Continue reading