Skip to content

Instantly share code, notes, and snippets.

@CoolOppo
Last active August 29, 2015 14:05
Show Gist options
  • Save CoolOppo/882f9a8de38a31c97c8d to your computer and use it in GitHub Desktop.
Save CoolOppo/882f9a8de38a31c97c8d to your computer and use it in GitHub Desktop.

launch4j exec error

I was having a shit ton of problems getting launch4j to work. Simply get a recent version of MinGW's ld.exe and windres.exe files, and replace the ones in the bin folder. That seems to do the trick.

Another thing to try is using the DOS path instead of the standard Windows one when you refer to the directory containing JRE. Apparently, the tool doesn't support paths with spaces in them, although it is somewhat sporadic. I used cygpath to generate my path. The command I used is cygpath -wsa "C:\Program Files (x86)\Java\jre1.8.0_20", which resulted in C:\PROGRA~2\Java\JRE18~1.0_2 as the DOS path.

A working XML config for launch4j is below.

<?xml version="1.0" encoding="UTF-8" ?>
<launch4jConfig>
  <dontWrapJar>false</dontWrapJar>
  <headerType>console</headerType>
  <jar>C:\Users\CoolOppo\Downloads\compiler-latest\compiler.jar</jar>
  <outfile>C:\Users\CoolOppo\Downloads\compiler-latest\yey.exe</outfile>
  <errTitle></errTitle>
  <cmdLine></cmdLine>
  <chdir></chdir>
  <priority>normal</priority>
  <downloadUrl>http://java.com/download</downloadUrl>
  <supportUrl></supportUrl>
  <stayAlive>false</stayAlive>
  <jre>
    <path>C:\PROGRA~2\Java\JRE18~1.0_2</path>
    <bundledJre64Bit>false</bundledJre64Bit>
    <minVersion></minVersion>
    <maxVersion></maxVersion>
    <jdkPreference>preferJre</jdkPreference>
    <runtimeBits>64/32</runtimeBits>
  </jre>
</launch4jConfig>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment