Page 1 of 1

How to close cmd after Programm startet

Posted: 20 Nov 2021 17:36
by Nils_8214
So i have a Batch File

Code: Select all

@echo off
set JLINK_VM_OPTIONS=
set DIR=%~dp0
"%DIR%\java" %JLINK_VM_OPTIONS% -m Test/org.openjfx.Main %*


which opens a javafx programm but the cmd is still opend how to let it close automaticly

Re: How to close cmd after Programm startet

Posted: 21 Nov 2021 05:03
by aGerman
You need to use the START command

Code: Select all

start "" "%DIR%\java" %JLINK_VM_OPTIONS% -m Test/org.openjfx.Main %*
The empty pair of quotes at the beginning is critical.

Steffen

Re: How to close cmd after Programm startet

Posted: 21 Nov 2021 05:45
by Nils_8214
still the same but now it has the openjdk icon

Re: How to close cmd after Programm startet

Posted: 21 Nov 2021 07:39
by aGerman
In this case it's likely the openjdk console which is still open (rather than the cmd console). I'm not familiar with openjdk. So I'm not able to give any advice here.

Steffen

Re: How to close cmd after Programm startet

Posted: 21 Nov 2021 17:47
by penpen
I'm not familiar with OpenJDK, but if it's similar to the JDK, then there are two executables:
One for windows ("javaw.exe") and one for the console window ("java.exe"). If you start the console version, then the console will stay open, because its streams (STDIN, STDOUT and STDERR) are connected with "System.in", "System.out" and "System.err". If you force the console to close, "java.exe" should also shut down.


penpen