Menu

#146 Java 17 support

Future
open
nobody
None
5
2023-08-04
2023-06-21
Marijus
No

Hello,
I would like to request for better support for java 17.
Whenever I run launch4j from maven with this configs:

<configuration>
                            <chdir>.</chdir>
                            <headerType>gui</headerType>
                            <downloadUrl>https://docs.aws.amazon.com/corretto/latest/corretto-17-ug/downloads-list.html</downloadUrl>
                            <jar>target/${project.build.finalName}.jar</jar>
                            <outfile>${staging.dir}/${info.appName}.exe</outfile>
                            <icon>${staging.dir}/images/256.ico</icon>
                            <classPath>
                                <mainClass>${mainClass}</mainClass>
                                <jarLocation>lib</jarLocation>
                            </classPath>
                            <jre>
                                <path>$JAVA_HOME</path>
                                <bundledJre64Bit>true</bundledJre64Bit>
                                <bundledJreAsFallback>true</bundledJreAsFallback>
                                <minVersion>17</minVersion>
                                <jdkPreference>preferJdk</jdkPreference>
                                <runtimeBits>64/32</runtimeBits>
                            </jre>
                            <versionInfo>
                                <fileVersion>${info.exeVersion}</fileVersion>
                                <txtFileVersion>${info.exeVersion}</txtFileVersion>
                                <fileDescription>${project.name}</fileDescription>
                                <copyright>C</copyright>
                                <productVersion>${info.exeVersion}</productVersion>
                                <txtProductVersion>${info.exeVersion}</txtProductVersion>
                                <productName>${project.name}</productName>
                                <internalName>${project.artifactId}</internalName>
                                <originalFilename>${project.artifactId}.exe</originalFilename>
                            </versionInfo>
                        </configuration>

I get an error:

[ERROR]
net.sf.launch4j.BuilderException: Enter: JRE path
    at net.sf.launch4j.Builder.build (Builder.java:76)
    at com.akathist.maven.plugins.launch4j.Launch4jMojo.doExecute (Launch4jMojo.java:478)
    at com.akathist.maven.plugins.launch4j.Launch4jMojo.execute (Launch4jMojo.java:342)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:342)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:330)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:175)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:76)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:163)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:160)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:910)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348)
    [ERROR] Failed to execute goal com.akathist.maven.plugins.launch4j:launch4j-maven-plugin:2.4.1:launch4j (l4j-create_installer_without_JRE) on project CryptoTool: Failed to build the executable; please verify your configuration.

Running the same code with java 11 seems to work fine. Any help with this would be much apreciated!

Discussion

  • Marijus

    Marijus - 2023-06-22

    the Launch4j does work with Java 17, but when I tried to create an installer from the jre I had an error saying that the jre is not found. It might have been my fault that the jre is not found, but I would like to see the error message include where it tried to search for and some healthful suggestions for the fix.

     

    Last edit: Marijus 2023-06-27
  • larsen255

    larsen255 - 2023-08-04

    See https://launch4j.sourceforge.net/docs.html#Configuration_file
    -> "Required element that groups JRE settings."

    You should set it to "<path>%JAVA_HOME%;%PATH%</path>"

     

Log in to post a comment.