Hello,
the tool you are developing offers a great opportunity to quickly and easily create a launcher. But it lacks an important option (related to modern java platform architecture).
By design you start the java application with something like this:
javaw -jar sample.jar
which makes the -jar
parameter mandatory (<jar>
attribute).
The modern Java modular architecture offers an option to create a custom runtime image that includes all the modules needed by the application. Launching an application in this case boils down to something like this:
javaw -m com.sample
or
javaw -m com.sample/com.sample.Main
Currently, in order to start such a project, it is necessary to submit a fictitious jar file to the <jar>
attribute.
<?xml version="1.0" encoding="UTF-8"?>
<launch4jConfig>
<dontWrapJar>true</dontWrapJar>
<headerType>gui</headerType>
<jar>fake.jar</jar>
<outfile>sample.exe</outfile>
<errTitle></errTitle>
<cmdLine></cmdLine>
<chdir>.</chdir>
<priority>normal</priority>
<downloadUrl></downloadUrl>
<supportUrl></supportUrl>
<stayAlive>false</stayAlive>
<restartOnCrash>false</restartOnCrash>
<manifest></manifest>
<icon></icon>
<jre>
<path>runtime</path>
<requiresJdk>false</requiresJdk>
<requires64Bit>true</requires64Bit>
<minVersion>19</minVersion>
<maxVersion></maxVersion>
<opt>-m com.sample/com.sample.Main</opt>
</jre>
</launch4jConfig>
I think it would be nice to make the <jar>
attribute optional.
Hello, thanks for pointing this out. I will have a look at it.
Best regards,
Grzegorz
On Sun, Nov 20, 2022, 08:16 mr.mcwolf mcwolf@users.sourceforge.net wrote:
Related
Feature Requests: #143
Hi,
I also want to wrap a Java 11 application. I meet the same issue. In addition, Launch4J adds a -jar to the invokation commands but -jar is not recognized any more by the jre11.
Cheers,
Loïc.
Hi all,
Just to provide more highlights on the base motivation, I provide a link to a StackOverflow page:
https://stackoverflow.com/questions/66818887/java-modules-and-the-jar-manifest-class-path-attribute
This mentions that one have two way to start a Java application with JDK 9+. Either you use the '-jar APP.jar' flag or the -m MODULE flag. With the first option, you disable all features related to the newly introduced Java Platform Module System, JPMS also known as Jigsaw.
We worked hard to switch to this system and we get many benefits from this effort, so we will not come back for the part we deliver to our customers.
Best regards,
Loïc.
Hi Loïc,
Sure, this is not a big deal to change. I've edited my comment, as I think you mean that the jar option does not work any longer with JPMS jar.
Best regards,
Grzegorz
Last edit: Grzegorz Kowal 2022-11-30