create a batch file open note pad type the followingBatch file

set path="...<where u install java>/bin"

java -jar myfile.jar

save the notepad as filename.bat and put it in folder containing jar file double click it automatically run

just for example i give you a sample

@echo off
set path="F:/java/bin"
java -jar myfile.jar

save it as filename.bat put it in a folder that contain filename.jar

if u can’t success in above try this in batch file (it work if you install java runtime (jre)

set path =c:Program FilesJavajre7binjavaw.exe
java -jar ImageEditor.jar

ImageEditor is jar file note both jar and bat file must be in same folder

How to create batch files for Java program tutorial

One thought on “How to create a cmd file to run jar tutorial

Leave a Reply

Your email address will not be published. Required fields are marked *