I have a .bat
file include this command java -jar example.jar
that runs example.jar
.
I don't want cmd.exe
to be visible on screen when the file is being executed. Is this possible?
you can hide it like this:
start javaw -jar example.jar
Or if you call it from inside of another project you can call like like this:
try {
Process p = Runtime.getRuntime().exec("cmd /c start /B example.bat");
p.waitFor();
} catch (InterruptedException ex) {
Logger.getLogger(OpenFileFromCmd.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(OpenFileFromCmd.class.getName()).log(Level.SEVERE, null, ex);
}
If you have any question just ask me :))
Start your bat file using the windows "start" command
Start "" /B "c:\myFolder\MyJavaLauncher.bat"
The "/B" option tell to start the program without showing the typical command window.
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