[英]launch4j exe can't find jre
Issues with launch4j launch4j 的问题
Program consists on one uber jar via maven-shade plugin and a Data/ Runs fine on any jre7 machine, windows or linux程序由一个 uber jar 组成,通过 maven-shade 插件和一个数据/在任何 jre7 机器上运行良好,windows 或 linux
However I've been unable to get launch4j to work.但是我一直无法让 launch4j 工作。
launch4j config.xml: launch4j config.xml:
<?xml version="1.0" encoding="UTF-8"?>
<launch4jConfig>
<dontWrapJar>false</dontWrapJar>
<headerType>gui</headerType>
<jar>pllsolver-0.2alpha.jar</jar>
<outfile>pllsolver-0.2alpha.exe</outfile>
<errTitle>NO JRE FOUND</errTitle>
<cmdLine></cmdLine>
<chdir></chdir>
<priority>normal</priority>
<downloadUrl>http://java.com/download</downloadUrl>
<supportUrl></supportUrl>
<stayAlive>false</stayAlive>
<manifest></manifest>
<icon>sicr.ico</icon>
<jre>
<path>jre7</path>
<bundledJre64Bit>false</bundledJre64Bit>
<minVersion></minVersion>
<maxVersion></maxVersion>
<jdkPreference>preferJre</jdkPreference>
<runtimeBits>64/32</runtimeBits>
</jre>
<splash>
<file>sicr.bmp</file>
<waitForWindow>false</waitForWindow>
<timeout>5</timeout>
<timeoutErr>true</timeoutErr>
</splash>
<messages>
</messages>
</launch4jConfig>
Then to build, on windows, I try this:然后在 windows 上构建,我试试这个:
PS K:\test> set PATH="K:\test\jre7\bin\"
PS K:\test> ..\launch4j\launch4jc.exe .\config.xml
launch4j: Compiling resources
launch4j: Linking
launch4j: Wrapping
launch4j: Successfully created K:\test\.\pllsolver-0.2alpha.exe
PS K:\test> .\pllsolver-0.2alpha.exe
PS K:\test>
It's at this point that I get a nice little window about how it failed to find the JRE.正是在这一点上,我得到了一个很好的小 window 关于它如何找不到 JRE。
Java is in K:\test\jre7\bin\java.exe My jar is K:\test\pllsolver-0.2alpha.jar Java 在 K:\test\jre7\bin\java.exe 我的 jar 在 K:\test\pllsolver-0.2alpha.jar
Additionally, I don't know if this will be an issue yet, but the executable and the Data/ need to be in the same directory.此外,我不知道这是否会成为一个问题,但可执行文件和 Data/ 需要位于同一目录中。 I'm planning to do better pathing later but I don't have a clear understanding of Windows ENV variables.
我打算稍后做更好的路径,但我对 Windows ENV 变量没有清楚的了解。
a bit late but maybe it can still help you ...有点晚了,但也许它仍然可以帮助你......
One thing which works for sure with launch4j and JRE is to bundle the JRE in the folder of your application.对 launch4j 和 JRE 肯定有效的一件事是将 JRE 捆绑在应用程序的文件夹中。
To do so:这样做:
... this should work ......这应该有效
I struggled around with the JRE setting using launch4j 3.12 (2020) and OpenJDK and got also the message "no java runtime found".我在使用 launch4j 3.12 (2020) 和 OpenJDK 的 JRE 设置方面苦苦挣扎,并且还收到消息“未找到 Java 运行时”。 My target, was to use OpenJDK ( https://adoptopenjdk.net/ ) Two ways were successful:
我的目标是使用 OpenJDK ( https://adoptopenjdk.net/ ) 两种方法都成功了:
It appears to be that launch4j is looking for the JRE path relative to its 'outfile' location.看起来 launch4j 正在寻找相对于其“outfile”位置的 JRE 路径。
Solutions:解决方案:
My launch4j version: 3.14我的launch4j版本:3.14
This fixed it for me.这为我修好了。 The
%PATH%
was missing %PATH%
丢失
<jre>
<path>%JAVA_HOME%;%PATH%</path>
<requiresJdk>false</requiresJdk>
<requires64Bit>false</requires64Bit>
<minVersion></minVersion>
<maxVersion></maxVersion>
</jre>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.