2012-08-03 104 views
0

我正在使用launch4j-maven插件在exe中製作2個java軟件。這兩個pom.xml中的插件都是相同的(應用程序名稱除外)。
Strangly當我推出第一EXE,lauch4j做是正確的:我可以看到myapps.exe運行和在日誌中我看到副本:Lauch4j不復制啓動程序

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=&quot;%JAVA_HOME%&quot;</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> 

感謝

回答

0

要啓動自定義過程的名稱您的應用程序在launch4J配置文件必須寫入

<customProcName>true</customProcName> 

在您的非工作應用程序配置此參數是false。 嘗試先改變它。

+0

我不知道爲什麼它會在我做的第一次嘗試中工作,也許我有另一個衝突選項。但customProcName工作。奇怪的事實是,我的其他maven項目沒有這個選項,但.exe得到正確的命名?! – zeraDev 2012-10-03 12:41:00

0

不能在Maven的部分評論,但我已經成功使用Launch4j使用Ant。查看構建可執行文件時傳遞給launch4j的XML文件。最有可能的第二個指定dontWrapJar = true。

在Launch4j GUI中交替加載XML並檢查複選框「不包裝JAR」是而不是已檢查。

+0

可能不是'dontWrapJar = true',而是'customProcName = false' – Nestor 2012-08-03 16:56:21

+0

也許,我覺得這個問題含糊其詞。 – Durandal 2012-08-03 17:06:38

+0

那麼我已經嘗試設置dontWrapJar = false和customProcName = false(即使它的默認值),問題仍然存在。 – zeraDev 2012-08-06 08:26:33