- status: open --> accepted
- assigned_to: Grzegorz Kowal
In the Launch4j settings I have %JAVA_HOME%;%PATH% set for <jre><path> entry. Which works to some extent, looking for JRE in JAVA_HOME and then searching the PATH.
When you install Oracle Java, it will NOT create JAVA_HOME environment variable. It will only add C:\Program Files (x86)\Common Files\Oracle\Java\javapath\ to the PATH.
The problem is that all executable files are directly under C:\Program Files (x86)\Common Files\Oracle\Java\javapath\. There is no bin folder, which is expected by Launch4j as you can see from the logs below.
If I go and manually create a bin folder under the path above and copy the java exe files there, then it would work.
I think the problem is at line 539 file head.c where there is a call to appendLauncher(launcherPath);.
This function is going to add the bin to the launcher path:
void appendLauncher(char* jrePath)
{
if (console)
{
appendPath(jrePath, "bin\\java.exe");
}
else
{
appendPath(jrePath, "bin\\javaw.exe");
}
}
I think this would work for most of the JREs but since Oracle wants to be always different, they don't have the bin folder and would cause this trouble for us.
So I think better solution here is to check for \bin\java.exe and \java.exe in isLauncherPathValid function instead of \bin
Version: 3.14
CmdLine: C:\Program Files\Test\Test.exe --l4j-debug
WOW64: yes
Working dir: C:\Program Files\Test\.
Java min ver:
Java max ver:
Substitute: JAVA_HOME =
Substitute: PATH = C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\apache-maven-3.8.1\bin;C:\Program Files (x86)\Inno Setup 6;C:\Users\farza\AppData\Local\Microsoft\WindowsApps;C:\Users\farza\AppData\Local\Programs\Microsoft VS Code\bin
Bundled JRE(s): ;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\apache-maven-3.8.1\bin;C:\Program Files (x86)\Inno Setup 6;C:\Users\farza\AppData\Local\Microsoft\WindowsApps;C:\Users\farza\AppData\Local\Programs\Microsoft VS Code\bin
Check launcher: C:\Program Files (x86)\Common Files\Oracle\Java\javapath\bin\javaw.exe (not found)
Check launcher: C:\Windows\system32\bin\javaw.exe (not found)
Check launcher: C:\Windows\bin\javaw.exe (not found)
Check launcher: C:\Windows\System32\Wbem\bin\javaw.exe (not found)
Check launcher: C:\Windows\System32\WindowsPowerShell\v1.0\bin\javaw.exe (not found)
Check launcher: C:\Windows\System32\OpenSSH\bin\javaw.exe (not found)
Check launcher: C:\Program Files\Git\cmd\bin\javaw.exe (not found)
Check launcher: C:\apache-maven-3.8.1\bin\javaw.exe (not found)
Check launcher: C:\Program Files (x86)\Inno Setup 6\bin\javaw.exe (not found)
Check launcher: C:\Users\farza\AppData\Local\Microsoft\WindowsApps\bin\javaw.exe (not found)
Check launcher: C:\Users\farza\AppData\Local\Programs\Microsoft VS Code\bin\javaw.exe (not found)
Error msg: This application requires a Java Runtime Environment.