Menu

#143 Make the jar attribute optional

Next release
accepted
None
5
2022-11-30
2022-11-20
mr.mcwolf
No

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.

Related

Feature Requests: #143

Discussion

  • Grzegorz Kowal

    Grzegorz Kowal - 2022-11-21

    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:


    Status: open
    Group: Future
    Created: Sun Nov 20, 2022 07:15 AM UTC by mr.mcwolf
    Last Updated: Sun Nov 20, 2022 07:15 AM UTC
    Owner: nobody

    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).</jar>

    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.</jar>

    <?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.</jar>

    Sent from sourceforge.net because you indicated interest in
    https://sourceforge.net/p/launch4j/feature-requests/143/

    To unsubscribe from further messages, please visit
    https://sourceforge.net/auth/subscriptions/

     

    Related

    Feature Requests: #143

  • Loic Decloedt

    Loic Decloedt - 2022-11-29

    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.

     
  • Loic Decloedt

    Loic Decloedt - 2022-11-30

    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.

     
    • Grzegorz Kowal

      Grzegorz Kowal - 2022-11-30

      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
  • Grzegorz Kowal

    Grzegorz Kowal - 2022-11-30
    • Group: Future --> Next release
     
  • Grzegorz Kowal

    Grzegorz Kowal - 2022-11-30
    • status: open --> accepted
    • assigned_to: Grzegorz Kowal
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.