Menu

#141 Support alternative JDK installations

Future
open
nobody
None
5
2022-01-16
2022-01-16
No

Hi,

I used launch4j to bundle an app as Windows application. Worked like a charm, but unfortunately, my first try to execute it on a test machine failed. The EXE complains that it requires a Java 11 runtime but does not find one - even if one was installed on the machine.

There are currently some more distributors of JDKs besides Oracle. Wouldn't it be great, if the launcher could know them in advance to create executables that work by default? If that's not the case, one could want to configure a list of "well-known" JDK installations and their registry keys so that a launch4j user can create a launcher even if the "new" JDK distribution is not yet known by launch4j.

Bundling the JDK with the app is not an option. It's not acceptable to install 10 JDKs just for installing 10 Apps. The JAVA_HOME approach also does not work, because the default installation procedure (at least for Adoptium) does not suggest to set this environment variable.

My test machine is configured as follows:

Java is installed, on the console, I get:

java -version
openjdk version "11.0.13" 2021-10-19
OpenJDK Runtime Environment Temurin-11.0.13+8 (build 11.0.13+8)
OpenJDK 64-Bit Server VM Temurin-11.0.13+8 (build 11.0.13+8, mixed mode)

When starting my app with debug option, I get a log file that reads as follows:

Version: 3.14
CmdLine: C:\Users\haui\Desktop\wizard.exe --l4j-debug
WOW64: yes
Working dir: C:\Users\haui\Desktop.
Java min ver: 1.011.000
Java max ver:
64-bit search: SOFTWARE\JavaSoft\Java Runtime Environment...
32-bit search: SOFTWARE\JavaSoft\Java Runtime Environment...
64-bit search: SOFTWARE\JavaSoft\Java Development Kit...
32-bit search: SOFTWARE\JavaSoft\Java Development Kit...
64-bit search: SOFTWARE\JavaSoft\JRE...
32-bit search: SOFTWARE\JavaSoft\JRE...
64-bit search: SOFTWARE\JavaSoft\JDK...
32-bit search: SOFTWARE\JavaSoft\JDK...
64-bit search: SOFTWARE\IBM\Java Runtime Environment...
32-bit search: SOFTWARE\IBM\Java Runtime Environment...
64-bit search: SOFTWARE\IBM\Java Development Kit...
32-bit search: SOFTWARE\IBM\Java Development Kit...
64-bit search: SOFTWARE\IBM\Java2 Runtime Environment...
32-bit search: SOFTWARE\IBM\Java2 Runtime Environment...
64-bit search: SOFTWARE\IBM\Java Development Kit...
32-bit search: SOFTWARE\IBM\Java Development Kit...
Error msg: This application requires a Java Runtime Environment 11
Open URL: http://java.com/download

The JDK installed on the machine has the following registry keys:

Schlüsselname: HKEY_LOCAL_MACHINE\SOFTWARE\Eclipse Adoptium
Klassenname: <keine klasse="">
Letzter Schreibzugriff: 16.01.2022 - 09:56</keine>

Schlüsselname: HKEY_LOCAL_MACHINE\SOFTWARE\Eclipse Adoptium\JDK
Klassenname: <keine klasse="">
Letzter Schreibzugriff: 16.01.2022 - 09:56</keine>

Schlüsselname: HKEY_LOCAL_MACHINE\SOFTWARE\Eclipse Adoptium\JDK\11.0.13.8
Klassenname: <keine klasse="">
Letzter Schreibzugriff: 16.01.2022 - 09:56</keine>

Schlüsselname: HKEY_LOCAL_MACHINE\SOFTWARE\Eclipse Adoptium\JDK\11.0.13.8\hotspot
Klassenname: <keine klasse="">
Letzter Schreibzugriff: 16.01.2022 - 09:56</keine>

Schlüsselname: HKEY_LOCAL_MACHINE\SOFTWARE\Eclipse Adoptium\JDK\11.0.13.8\hotspot\MSI
Klassenname: <keine klasse="">
Letzter Schreibzugriff: 16.01.2022 - 09:56
Wert 0
Name: Path
Typ: REG_SZ
Daten: C:\Program Files\Eclipse Adoptium\jdk-11.0.13.8-hotspot\</keine>

Wert 1
Name: EnvironmentPath
Typ: REG_DWORD
Daten: 0x1

Wert 2
Name: EnvironmentPathSetForSystem
Typ: REG_DWORD
Daten: 0x1

Wert 3
Name: Main
Typ: REG_DWORD
Daten: 0x1

Discussion


Log in to post a comment.