.BAT files: running JVM in the background

After reading the message in .bat files, non-blocking start / start ,

I still can’t achieve what I need: so that the .BAT file closes after running the start command. My problem is that when the JVM starts, the application launches the window, so I end up with 2 windows being openend, when in fact one of them (the .BAT command) is just a startup process and does nothing significant for the user .

I am inserting .BAT code here:

 @echo off
 setlocal
 rem Starts the application

 rem Check for Java Home and use that if available
 if not "[% JAVA_HOME%]" == "[]" goto start_app
 echo.  JAVA_HOME not set.  Application will not run!
 goto end
 : start_app
 echo.  Using java in% JAVA_HOME%
 start "Application" "% JAVA_HOME% / bin / java.exe" -jar lib / pathToMyJarFile
 goto end

 : end

I want the .BAT process to complete (or at least close the window) after starting the JVM.

Regards, Cristian

+4
source share
2 answers

Try javaw.exe instead of java.exe.

+7
source
+1
source

Source: https://habr.com/ru/post/1397224/


All Articles