【发布时间】: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