[英]Lauch4j doesn't copy launcher
我正在通过launch4j-maven插件在exe中构建2个Java软件。两个pom.xml中的plugins-parts相同(除了应用程序名称)。
刚好在我启动第一个exe时,lauch4j正确完成了:我可以看到myapps.exe正在运行,并且在日志中可以看到副本:
Using 64-bit runtime.
Check launcher: C:\Program Files\Java\jre7\bin\javaw.exe (OK)
Copy: C:\Program Files\Java\jre7\bin\javaw.exe -> C:\Program Files\Java\jre7\launch4j-tmp\NumSyncManager.exe
Heap -Xms: 5 MB / 0%, Free: 892 MB, Heap size: 5 MB
Heap -Xmx: 15 MB / 0%, Free: 892 MB, Heap size: 15 MB
...
Launcher: C:\Program Files\Java\jre7\launch4j-tmp\NumSyncManager.exe
Launcher args: -Xms5m -Xmx15m -classpath "C:\Program iles\..."
Args length: 474/32768 chars
Exit code: 0
但是当我启动第二个程序时,我看到的是javaw.exe而不是myapps2.exe,并且在日志中我清楚地看到它没有复制启动程序:
Using 64-bit runtime.
Check launcher: C:\Program Files\Java\jre7\bin\javaw.exe (OK)
Heap -Xms: 10 MB / 0%, Free: 951 MB, Heap size: 10 MB
Heap -Xmx: 500 MB / 0%, Free: 951 MB, Heap size: 500 MB
...
Launcher: C:\Program Files\Java\jre7\bin\javaw.exe
Launcher args: -Xms10m -Xmx500m -classpath "C:\Program..."
Args length: 817/32768 chars
Exit code: 0
这里是正在运行的应用程序的xml文件:
<configuration>
<headerType>gui</headerType>
<outfile>target/${winName}.exe</outfile>
<jar>target/${artifactId}-${version}-jar-with-dependencies.jar</jar> <!-- 'shaded' is the value set on shadedClassifierName above -->
<errTitle>Erreur lors du lancement du logiciel</errTitle>
<classPath>
<mainClass>fr.core.BootStrap</mainClass>
</classPath>
<singleInstance>
<mutexName>${winName}</mutexName>
<windowTitle>${winName}</windowTitle>
</singleInstance>
<jre>
<minVersion>1.6.0</minVersion>
<initialHeapSize>50</initialHeapSize>
<maxHeapSize>100</maxHeapSize>
</jre>
<versionInfo>
<fileVersion>${version}.0</fileVersion>
<txtFileVersion>${version}.0</txtFileVersion>
<fileDescription>Tool Manager</fileDescription>
<copyright>C</copyright>
<productVersion>${version}.0</productVersion>
<txtProductVersion>${version}.0</txtProductVersion>
<productName>${winName}</productName>
<internalName>${winName}</internalName>
<originalFilename>${winName}.exe</originalFilename>
</versionInfo>
</configuration>
这是无法正常工作的应用程序的xml
<headerType>gui</headerType>
<outfile>target/${winName}.exe</outfile>
<jar>target/${artifactId}-${version}-jar-with-dependencies.jar</jar> <!-- 'shaded' is the value set on shadedClassifierName above -->
<errTitle>Erreur lors du lancement du logiciel</errTitle>
<classPath>
<mainClass>fr.boot.BootStrap</mainClass>
</classPath>
<singleInstance>
<mutexName>${winName}</mutexName>
<windowTitle>${winName}</windowTitle>
</singleInstance>
<dontWrapJar>false</dontWrapJar>
<customProcName>false</customProcName>
<jre>
<minVersion>1.6.0</minVersion>
<initialHeapSize>10</initialHeapSize>
<maxHeapSize>500</maxHeapSize>
</jre>
<versionInfo>
<fileVersion>${winVersion}.0</fileVersion>
<txtFileVersion>${winVersion}.0</txtFileVersion>
<fileDescription>Tool</fileDescription>
<copyright>c</copyright>
<productVersion>${winVersion}.0</productVersion>
<txtProductVersion>${winVersion}.0</txtProductVersion>
<productName>${winName}</productName>
<internalName>${winName}</internalName>
<originalFilename>${winName}.exe</originalFilename>
</versionInfo>
</configuration>
我使用相同的Windows帐户启动它们,没有权限问题。 所以我不知道如何解决这个问题。
我尝试使用Launch4j.exe代替maven插件,这是我的配置导出。 它仍然不起作用:
<launch4jConfig>
<dontWrapJar>false</dontWrapJar>
<headerType>gui</headerType>
<jar>C:\apps-0.0.1-jar-with-dependencies.jar</jar>
<outfile>C:\apps.exe</outfile>
<errTitle></errTitle>
<cmdLine></cmdLine>
<chdir></chdir>
<priority>normal</priority>
<downloadUrl>http://java.com/download</downloadUrl>
<supportUrl></supportUrl>
<customProcName>false</customProcName>
<stayAlive>false</stayAlive>
<manifest></manifest>
<icon></icon>
<singleInstance>
<mutexName>apps</mutexName>
<windowTitle>apps</windowTitle>
</singleInstance>
<classPath>
<mainClass>fr.core.BootStrap</mainClass>
<cp>fr.core.BootStrap</cp>
</classPath>
<jre>
<path></path>
<minVersion>1.6.0</minVersion>
<maxVersion></maxVersion>
<jdkPreference>preferJre</jdkPreference>
<opt>-Denv.java.home="%JAVA_HOME%"</opt>
</jre>
<versionInfo>
<fileVersion>1.0.0.0</fileVersion>
<txtFileVersion>1.0.0.0</txtFileVersion>
<fileDescription>desc</fileDescription>
<copyright>e</copyright>
<productVersion>1.0.0.0</productVersion>
<txtProductVersion>1.0.0.0</txtProductVersion>
<productName>apps.exe</productName>
<companyName>appsComp</companyName>
<internalName>apps</internalName>
<originalFilename>apps.exe</originalFilename>
</versionInfo>
</launch4jConfig>
谢谢
无法评论Maven部分,但是我已经成功地将Launch4j与Ant结合使用了。 查看构建可执行文件时传递给launch4j的XML文件。 第二个很有可能指定dontWrapJar = true。
或者加载Launch4j GUI的XML和检查复选框“不自动换JAR” 未选中。
要在launch4J配置文件中使用自定义进程名称启动您的应用,
<customProcName>true</customProcName>
在您无法使用的应用程序配置中,此参数为false
。 尝试先更改它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.