With JPackage I am unable to get --win-console option to work apart for for the main launcher, but I want the main launcher not to output to console, but have a debug version that does.
i.e if I run
jpackage --add-launcher SongKongDebug=jpackage.properties @jpackage.txt
jpackage.txt
-i C:\Code\jthink\SongKong\target\songkong-6.10
--runtime-image C:\code\jthink\songkong\JVM64
--main-class com.jthink.songkong.cmdline.SongKong
--name SongKong
--win-dir-chooser
--main-jar lib\SongKong-6.10.jar
--app-version 6.10
--install-dir Jthink\SongKong
--copyright "Copyright 2020 JThink Ltd, United Kingdom"
--license-file C:\Code\jthink\SongKong\src\main\scripts\license.txt
--java-options "-Dhttps.protocols=TLSv1.1,TLSv1.2"
--java-options "--add-opens java.base/java.lang=ALL-UNNAMED"
--java-options "-XX:MaxRAMPercentage=75.0"
--java-options "-XX:MetaspaceSize=45 "
--java-options "-Dcom.mchange.v2.log.MLog=com.mchange.v2.log.jdk14logging.Jdk14MLog"
--java-options "-Dorg.jboss.logging.provider=jdk"
--java-options "-Djava.util.logging.config.class=com.jthink.songkong.logging.StandardLogging"
--vendor JThink
--win-menu
--win-shortcut
--win-menu-group Jthink
jpackage.properties
win-console=--win-console
then both SongKong and SongKongDebug run without console
I also tried modifying jpackage.properties (whicch is meant to be name/value pairs) to
--win-console
and it still didnt work
Whereas if I add
--win-console
to jpackage.txt and
win-console
to jpackage.properties
then SongKong will run as console, and SongKongDebug will not, but is wrong way round for me.
If I rename SongKong to SongKongDebug and SongKongDebug to SongKong
e.g
jpackage --add-launcher SongKong=jpackage.properties @jpackage.txt
and modify
set --name SongKongDebug
in jpackage.txt
then it works but now when install SongKong it says installing SongKongDebug which is wrong.
I have tried both current Java 14 release and early access java 15 and 16 releases but makes no difference.
I found this bug reported, but then user closed it as no problem https://bugs.openjdk.java.net/browse/JDK-8213717 and I find the jpackage help a bit confusing so I wonder if I am doing this the wrong way.
The help says
Options for creating the application launcher(s):
--add-launcher launcher name=file path
Name of launcher, and a path to a Properties file that contains a list of key, value pairs (absolute path or relative to the current
directory).
The keys "module", "add-modules", "main-jar", "main-class", "arguments", "java-options", "app-version", "icon", and "win-console"
can be used.
These options are added to, or used to overwrite, the original command line options to build an additional alternative launcher. The
main application launcher will be built from the command line options. Additional alternative launchers can be built using this option, and this option can be used multiple times to build multiple additional launchers. --arguments main class arguments
Command line arguments to pass to the main class if no command line arguments are given to the launcher. This option can be used multiple times.
--java-options java options
Options to pass to the Java runtime. This option can be used multiple times.
--main-class class name
Qualified name of the application main class to execute. This option can only be used if --main-jar is specified.
--main-jar main jar file
The main JAR of the application; containing the main class (specified as a path relative to the input path). Either --module or --main-jar option can be specified but not both.
--module or -m module name/main class]
The main module (and optionally main class) of the application This module must be located on the module path. When this option is specified, the main module will be linked in the Java runtime image. Either --module or --main-jar option can be
specified but not both.
So yo can create addtional launcher with the --add-launcher and use a properties file, but it also makes it sounds yo can can pass extra arguments as additional comand line options, but how could that be as it would not be clear which launcher they refer to ?