Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.BAT files: Launch the JVM in background

Having read the post at .bat files, nonblocking run/launch,

I still cannot achieve what I need: to have the .BAT file close once the start command is executed. My problem is that when the JVM starts the application launches a window so I end up with 2 windows being opened, when in fact one of them (the .BAT command) is just a startup process and doesn't do anything meaningful to the user.

I paste the .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'd like the .BAT process to terminate (or at least the window to close) once the JVM starts.

like image 735
Cristian Botiza Avatar asked Feb 22 '23 10:02

Cristian Botiza


1 Answers

Try javaw.exe instead of java.exe.

like image 116
Gijs Overvliet Avatar answered Feb 23 '23 23:02

Gijs Overvliet