我知道有很多类似的问题,但我无法使其与这些解决方案一起工作。
我正在使用Launch4J 3.50,并尝试使用由adoptium提供的捆绑JRE运行exe https://adoptium.net/temurin/releases/?version=11
通过从 bat 文件启动 exe,使用 SET Launch4j=debug 选项,我能够生成此日志文件:
Version: 3.50
CmdLine: D:\MyApp.exe
JNI: No
WOW64: Yes
Working dir: D:\.
Requires JDK: Yes
Requires 64-Bit: No
Java min ver: 1.011.000_000
Java max ver: 1.011.900_900
JRE paths: service\adoptium
Check launcher: D:\service\adoptium\bin\javaw.exe (OK)
Check javac: D:\service\adoptium\bin\javac.exe (not found)
64-bit search: SOFTWARE\JavaSoft\Java Development Kit...
32-bit search: SOFTWARE\JavaSoft\Java Development Kit...
64-bit search: SOFTWARE\JavaSoft\JDK...
32-bit search: SOFTWARE\JavaSoft\JDK...
64-bit search: SOFTWARE\IBM\Java Development Kit...
32-bit search: SOFTWARE\IBM\Java Development Kit...
64-bit search: SOFTWARE\IBM\Java Development Kit...
32-bit search: SOFTWARE\IBM\Java Development Kit...
Error msg: This application requires a Java Runtime Environment 11.0.0 - 11.900.900
这是我的根文件夹:
这是我的服务文件夹:
这是我的 Launch4J xml 配置文件:
<?xml version="1.0" encoding="UTF-8"?>
<launch4jConfig>
<dontWrapJar>false</dontWrapJar>
<headerType>gui</headerType>
<jar>C:\Users\jhonnyD\Desktop\launch4j\service\jars\MyApp.jar</jar>
<outfile>.\MyApp.exe</outfile>
<errTitle></errTitle>
<cmdLine></cmdLine>
<chdir>.</chdir>
<priority>normal</priority>
<downloadUrl></downloadUrl>
<supportUrl></supportUrl>
<stayAlive>false</stayAlive>
<restartOnCrash>false</restartOnCrash>
<manifest></manifest>
<icon>C:\Users\jhonnyD\Desktop\launch4j\myIcon.ico</icon>
<classPath>
<mainClass>com.main.StartMyApp</mainClass>
<cp>C:\Users\jhonnyD\Desktop\launch4j\service\jars\lib\*</cp>
</classPath>
<jre>
<path>service/adoptium</path>
<requiresJdk>true</requiresJdk>
<requires64Bit>false</requires64Bit>
<minVersion>11.0.0</minVersion>
<maxVersion>11.900.900</maxVersion>
</jre>
</launch4jConfig>
当我在安装了 java 的计算机上运行它时,exe 可以运行。显然它正在从系统中获取 jre。当我在缺少 java 的计算机上运行此程序时,我得到:
This application requires a Java Runtime Environment 11.0.0 - 11.900.900
奇怪的是,日志指出发现了捆绑的 javaw.exe:
Check launcher: D:\service\adoptium\bin\javaw.exe (OK)
我在这里错过了什么吗?
似乎您需要将标签
<requiresJdk>
中的选项从true
更改为false
。
我刚刚在我的应用程序上使用类似的配置测试了 launch4j 3.50,它在这个最小配置下工作得很好:
<?xml version="1.0" encoding="UTF-8"?>
<launch4jConfig>
<dontWrapJar>false</dontWrapJar>
<headerType>gui</headerType>
<jar>C:\launch4j-3.50-win32\service\jars\dvm.jar</jar>
<outfile>C:\launch4j-3.50-win32\dvm.exe</outfile>
<errTitle></errTitle>
<cmdLine></cmdLine>
<chdir>.</chdir>
<priority>normal</priority>
<downloadUrl></downloadUrl>
<supportUrl></supportUrl>
<stayAlive>false</stayAlive>
<restartOnCrash>false</restartOnCrash>
<manifest></manifest>
<icon></icon>
<jre>
<path>service/adoptium</path>
<requiresJdk>false</requiresJdk>
<requires64Bit>false</requires64Bit>
<minVersion></minVersion>
<maxVersion></maxVersion>
</jre>
</launch4jConfig>
Estive como um Problema identico hoje and descobri que Launch4j 3.50 não inseri litermente o jre por ele apenas pede o caminho que semper vai aceder para encontrar o jre, então usei o inosetup para criar um setup and adicionar o jre que possuo, deste jeito so adicionei o nome da Pasta do jre no meuprojecto e funcionou no meu caso