我是第一次使用 launch4j,但出现以下错误。这是 launch4j 错误日志。
Compiling resources
Generated resource file...
LANGUAGE 0, 1
2 RCDATA BEGIN "1.5.0\0" END
18 RCDATA BEGIN "1\0" END
21 RCDATA BEGIN "http://java.com/download\0" END
20 RCDATA BEGIN "32\0" END
101 RCDATA BEGIN "An error occurred while starting the application.\0" END
102 RCDATA BEGIN "This application was configured to use a
bundled Java Runtime Environment but the runtime is missing or corrupted.\0" END
103 RCDATA BEGIN "This application requires a Java Runtime Environment\0" END
104 RCDATA BEGIN "The registry refers to a nonexistent
Java Runtime Environment installation or the runtime is corrupted.\0" END
17 RCDATA BEGIN "true\0" END
这是生成的xml文件
<launch4jConfig>
<dontWrapJar>false</dontWrapJar>
<headerType>gui</headerType>
<jar>/DesktopApp/launch4j/applicationname.jar</jar>
<outfile>/DesktopApp/launch4j/applicationname.exe</outfile>
<errTitle></errTitle>
<cmdLine></cmdLine>
<chdir></chdir>
<priority>normal</priority>
<downloadUrl>http://java.com/download</downloadUrl>
<supportUrl></supportUrl>
<stayAlive>false</stayAlive>
<manifest></manifest>
<icon></icon>
<jre>
<path></path>
<bundledJre64Bit>false</bundledJre64Bit>
<minVersion>1.5.0</minVersion>
<maxVersion></maxVersion>
<jdkPreference>preferJre</jdkPreference>
</jre>
</launch4jConfig>
非常感谢您的帮助。如果有 launch4j 的替代方案,请告诉我。
我试图使用 *.png 文件作为我的图标,但它需要 *.ico。一旦我从我的配置文件中删除
<icon>...</icon>
,这个错误就消失了。
我以管理员身份运行 launch4j 应用程序,错误对我来说消失了。
检查您正在使用的图标文件(如果您正在使用)。尝试包装我的 java 可执行文件时,我遇到了同样的错误。我使用的是一个 png 文件,我将其转换为我认为的图标 (.ico) 文件。原来这个转换没有用。使用我在 Windows 系统上找到的正确的 .ico 文件后,我使用了它并且它起作用了。
将您的 png 或 jpeg 文件转换为图标文件,错误将会消失。
您可以使用在线工具:- http://iconverticons.com/online/
原因是执行 EXE 文件的机器上的 JRE 版本。
给出路径如\jre_path 例如,如果您有一个文件夹 dist,其中 bin 作为子文件夹,其中包含 jre 文件。
[适用于 Windows 的 launch4j][1]
如果您使用的是 Windows,请确保您的 launch4j 有一个“.exe”扩展名而不是“.jar” [1]:https://sourceforge.net/projects/launch4j/
希望有帮助。