Wrapped .exe with launch4j and jdk8 takes very long to start. Using jdk7 instead starts almost instant

允我心安 提交于 2019-12-11 11:34:30

问题


I have the following problem:

I used to have a launch4j config to create a wrapped executable from my runable jar using a bundeled jdk/jre7 for quite some time.

The Programm (launched with that .exe) starts almost immediatly with jdk7. I now had to switch to jdk8 which results in a VERY slow startup. Everything works just fine, that is not the problem, but the launch process of that .exe takes ~1-2 Minutes and I simply don't get why.

Starting the application from within eclipse (using the same JDK8) it starts within seconds again (as it should!).

So... Any ideas what might cause this and how I can fix it?

Here is my current l4j.xml:

<?xml version="1.0" encoding="UTF-8"?>
<launch4jConfig>
  <dontWrapJar>false</dontWrapJar>
  <headerType>gui</headerType>
  <jar>C:\Users\user\workspace\DataUpdater\release\bin\DataUpdater-v2.6.1.jar</jar>
  <outfile>C:\Users\user\workspace\DataUpdater\release\DataUpdater.exe</outfile>
  <errTitle>DataUpdater: Kein kompatibles JRE gefunden</errTitle>
  <cmdLine></cmdLine>
  <chdir>.</chdir>
  <priority>high</priority>
  <downloadUrl>http://java.com/download</downloadUrl>
  <supportUrl>https://www.google.de/</supportUrl>
  <stayAlive>true</stayAlive>
  <restartOnCrash>false</restartOnCrash>
  <manifest></manifest>
  <icon>C:\Users\user\workspace\DataUpdater\res\icons\DataUpdater.ico</icon>
  <singleInstance>
    <mutexName>DataUpdater v2.6.1</mutexName>
    <windowTitle>DataUpdater v2.6.1</windowTitle>
  </singleInstance>
  <jre>
    <path>./bundeled/jre1.8.0_92</path>
    <bundledJre64Bit>true</bundledJre64Bit>
    <bundledJreAsFallback>false</bundledJreAsFallback>
    <minVersion>1.8.0</minVersion>
    <maxVersion>1.8.0_92</maxVersion>
    <jdkPreference>jdkOnly</jdkPreference>
    <runtimeBits>64</runtimeBits>
    <initialHeapPercent>33</initialHeapPercent>
    <maxHeapPercent>80</maxHeapPercent>
    <opt>-Dfile.encoding=UTF-8</opt>
  </jre>
  <versionInfo>
    <fileVersion>2.6.1.0</fileVersion>
    <txtFileVersion>v2.6.1</txtFileVersion>
    <fileDescription>DataUpdater: Anwendung zum aktualisieren von -Datensätzen mittels externer Datenquellen wie Excel-Tabellen direkt auf Datenbankebene.</fileDescription>
    <copyright>Max Mustermann</copyright>
    <productVersion>2.6.1.0</productVersion>
    <txtProductVersion>v2.6.1</txtProductVersion>
    <productName>DataUpdater</productName>
    <companyName>Max Mustermann</companyName>
    <internalName>DataUpdater v2.6.1</internalName>
    <originalFilename>DataUpdater.exe</originalFilename>
  </versionInfo>
  <messages>
    <startupErr>DataUpdater konnte nicht gestartet werden. </startupErr>
    <bundledJreErr>DataUpdater erwartet ein bundled JRE. Dieses wurde nicht gefunden oder ist beschädigt.</bundledJreErr>
    <jreVersionErr>DataUpdater benötigt eine Java Laufzeitumgebung. Diese konnte nicht gefunden werden.
Bitte stellen Sie sicher, dass Java 8 auf Ihrem System installiert ist.</jreVersionErr>
    <launcherErr>Die Windows Registry verweist auf eine nicht mehr vorhandene oder beschädigte Java Installation.</launcherErr>
    <instanceAlreadyExistsMsg>DataUpdater wird bereits ausgeführt. 
Es ist immer nur eine DataUpdater-Instanz gleichzeitig erlaubt.</instanceAlreadyExistsMsg>
  </messages>
</launch4jConfig>

Edit: The executable reacts the same on many different machines so it is not related to my local environment...

Additional Info: I just noticed, that launching the application from the jar directly instead of the executable results in the same slow startup. So this MUST be related to the jdk8 somehow and not to l4j. What I do not understand is why it starts so fast from within eclipse using the same jdk8.


回答1:


After a long research without any good result i noticed, that this "hang up" is not related to launch4j & Java 8 but related to log4j and Java 8.

Still not clear what excatly causes this but it is the topic of another question.



来源:https://stackoverflow.com/questions/37185972/wrapped-exe-with-launch4j-and-jdk8-takes-very-long-to-start-using-jdk7-instead

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!