Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run .jar from batch-file

I have created an executable .jar file. How can I execute the .jar using a batch-file without mentioning a class path?

like image 584
Arivu2020 Avatar asked Apr 12 '10 12:04

Arivu2020


People also ask

How do I run a jar from a 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.

How do I run a .JAR file automatically?

If you have a JAR file which is not running on its own, then you can use java JDK to run it. Open Command Prompt, and type java -jar name_of_jar_file. jar. It will execute the JAR file automatically.

How do I run a java program from a batch file?

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?

How do I manually run a JAR file?

To execute JavaScript in a browser you have two options — either put it inside a script element anywhere inside an HTML document, or put it inside an external JavaScript file (with a . js extension) and then reference that file inside the HTML document using an empty script element with a src attribute.


1 Answers

On Windows you can use the following command.

start javaw -jar JarFile.jar 

By doing so, the Command Prompt Window doesn't stay open.

like image 83
Jleuleu Avatar answered Sep 21 '22 09:09

Jleuleu