Reputation: 1188
Issues with launch4j
Program consists on one uber jar via maven-shade plugin and a Data/ Runs fine on any jre7 machine, windows or linux
However I've been unable to get launch4j to work.
launch4j config.xml:
<?xml version="1.0" encoding="UTF-8"?>
<launch4jConfig>
<dontWrapJar>false</dontWrapJar>
<headerType>gui</headerType>
<jar>pllsolver-0.2alpha.jar</jar>
<outfile>pllsolver-0.2alpha.exe</outfile>
<errTitle>NO JRE FOUND</errTitle>
<cmdLine></cmdLine>
<chdir></chdir>
<priority>normal</priority>
<downloadUrl>http://java.com/download</downloadUrl>
<supportUrl></supportUrl>
<stayAlive>false</stayAlive>
<manifest></manifest>
<icon>sicr.ico</icon>
<jre>
<path>jre7</path>
<bundledJre64Bit>false</bundledJre64Bit>
<minVersion></minVersion>
<maxVersion></maxVersion>
<jdkPreference>preferJre</jdkPreference>
<runtimeBits>64/32</runtimeBits>
</jre>
<splash>
<file>sicr.bmp</file>
<waitForWindow>false</waitForWindow>
<timeout>5</timeout>
<timeoutErr>true</timeoutErr>
</splash>
<messages>
</messages>
</launch4jConfig>
Then to build, on windows, I try this:
PS K:\test> set PATH="K:\test\jre7\bin\"
PS K:\test> ..\launch4j\launch4jc.exe .\config.xml
launch4j: Compiling resources
launch4j: Linking
launch4j: Wrapping
launch4j: Successfully created K:\test\.\pllsolver-0.2alpha.exe
PS K:\test> .\pllsolver-0.2alpha.exe
PS K:\test>
It's at this point that I get a nice little window about how it failed to find the JRE.
Java is in K:\test\jre7\bin\java.exe My jar is K:\test\pllsolver-0.2alpha.jar
Additionally, I don't know if this will be an issue yet, but the executable and the Data/ need to be in the same directory. I'm planning to do better pathing later but I don't have a clear understanding of Windows ENV variables.
Upvotes: 2
Views: 9627
Reputation: 83
This fixed it for me. The %PATH%
was missing
<jre>
<path>%JAVA_HOME%;%PATH%</path>
<requiresJdk>false</requiresJdk>
<requires64Bit>false</requires64Bit>
<minVersion></minVersion>
<maxVersion></maxVersion>
</jre>
Upvotes: 1
Reputation: 104
It appears to be that launch4j is looking for the JRE path relative to its 'outfile' location.
Solutions:
My launch4j version: 3.14
Upvotes: 0
Reputation: 81
I struggled around with the JRE setting using launch4j 3.12 (2020) and OpenJDK and got also the message "no java runtime found". My target, was to use OpenJDK (https://adoptopenjdk.net/) Two ways were successful:
Upvotes: 3
Reputation: 458
a bit late but maybe it can still help you ...
One thing which works for sure with launch4j and JRE is to bundle the JRE in the folder of your application.
To do so:
... this should work
Upvotes: 3