I need to run my Java Application through .bat file. Can anybody help please.
1)open a notpad 2)copy and past this code and save this file as ex: test. bat 3)Double Click tha batch file. 4)put your java codes into the notepad and save it as N.B.:- save this java file same folder that your batch file exists. what's the purpose of opening up notepad when you just want to compile and run?
bat file to run multiple . bat files independent from each other in their own directories. Try cd to each directory in turn then run the batch file ...
If you want to keep your jar file and bat file in different locations then you need to provide the relative location of your jar file. Now, we can run the batch file by double-clicking on HelloWorld. bat file. When we double click on the bat file, then it should automatically start a jar file.
BAT is the batch file that is used in DOS, OS/2 and Microsoft Windows. CMD files are newer version came into existence for batch files. The older systems will not know about CMD files and will run them partially which will throw an error for the batch files saved as CMD.
Simply create a .bat file with the following lines in it:
@ECHO OFF set CLASSPATH=. set CLASSPATH=%CLASSPATH%;path/to/needed/jars/my.jar %JAVA_HOME%\bin\java -Xms128m -Xmx384m -Xnoclassgc ro.my.class.MyClass
Sure, call the java executable.
Mine is C:\Program Files\Java\jre6\bin\java.exe
, so to run it I would do
C:\Program Files\Java\jre6\bin\java.exe -jar myjarfile.jar
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With