【问题标题】:Application requires a JRE version应用程序需要 JRE 版本
【发布时间】:2016-12-07 15:28:35
【问题描述】:

当我尝试运行我的应用程序(编译后为.exe)将Java 更新为1.8.0_101 后,出现信息This application requires a Java Runtime Environment 1.8.0_40 并且应用程序未运行。我用launch4j

有人有同样的问题吗?知道为什么在更新 Java 后会显示它吗?

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>

launch4j插件配置

 <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>

编辑

minVersion 更改为1.8.0._101 后,它可以工作,但我对此并不满意,因为当Java(例如1.8.0_102)的下一个版本到来时,我也必须更改它...

【问题讨论】:

  • 您使用什么工具生成.exe
  • 使用Intelij IDEA编译
  • 我不认为 IDEA 作为 IDE 可以生成.exe-files(至少我还没有发现任何表明它可以生成的东西)。你可能有某种 java-exe-wrapper 之类的......
  • 我使用了 maven 安装,版本 org.apache.maven.plugins:maven-install-plugin:2.3.1。问题可能出在maven版本上?
  • 不,这也不是那个(安装插件用于将工件部署到远程存储库)。但是好的,现在我们知道您使用的是 maven,这就留下了什么插件生成 exe 的问题。 appassembler,launch4j 或其他的东西。一旦我们得到这个答案,您应该从您的 pom.xml 中发布相关部分。

标签: java version updates launch4j


【解决方案1】:

当 jre-version-number 超过 100 时,旧的 launch4j-versions 中似乎有 a bug。所以你必须使用 launch4j 3.9 版,它应该在 launch4j-plugin 的 1.7.11 版中。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-05-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-12
    相关资源
    最近更新 更多