Search code examples
javaversionupdateslaunch4j

Application requires a JRE version


After update Java to 1.8.0_101 when I try to run my application (which after compilation is .exe) appear information This application requires a Java Runtime Environment 1.8.0_40 and application not running. I used launch4j

Someone have the same problem ? Any idea why after update Java it is shown ?

pom.xml

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.0</version>
    <configuration>
        <source>1.8</source>
        <target>1.8</target>
        <encoding>${project.build.sourceEncoding}</encoding>
        <executable>${env.JAVA_HOME}</executable>
        <compilerArguments>
            <bootclasspath>${env.JAVA_HOME}/jre/lib/rt.jar:${env.JAVA_HOME}/jre/lib/jce.jar</bootclasspath>
        </compilerArguments>
    </configuration>
</plugin>

There is launch4j plugin configuration

 <plugin>
        <groupId>com.akathist.maven.plugins.launch4j</groupId>
        <artifactId>launch4j-maven-plugin</artifactId>
        <version>1.5.2</version>
        <executions>
            <execution>
                <id>l4j-gui</id>
                <phase>package</phase>
                <goals>
                    <goal>launch4j</goal>
                </goals>
                <configuration>
                    <headerType>gui</headerType>
                    <outfile>target/App.exe</outfile>
                    <jar>target/App.jar</jar>
                    <priority>high</priority>
                    <errTitle>App</errTitle>
                    <classPath>
                        <mainClass>com.app.Main</mainClass>
                    </classPath>
                    <jre>
                        <minVersion>1.8.0_40</minVersion>
                    </jre>
                    <versionInfo>
                        <productName>App</productName>
                        <internalName>app</internalName>
                        <originalFilename>App.exe</originalFilename>                                    
                    </versionInfo>
                </configuration>
            </execution>
        </executions>
  </plugin>

EDIT

After change the minVersion to 1.8.0._101 it works but I am not satisfied with this, because when next version of Java (for example 1.8.0_102) comes I will have to change this too...


Solution

  • It seems there is a bug in older launch4j-versions when the jre-version-number exceeds 100. So you have to use launch4j version 3.9 which should be in version 1.7.11 of the launch4j-plugin.