Search code examples
javacompiler-errorslaunch4j

Launch4j | "This application requires a Java Runtime Environment." when opening .exe, that is a .jre file converted to .exe


I run the file with command prompt

Command:

file.exe

Output:

This application requires a Java Runtime Environment.

Is this error due to the .exe using the wrong JRE path?

I've tried the below variations:

  1. C:\Program Files\Common Files\Oracle\Java\javapath\java.exe
  2. C:\Program Files\Common Files\Oracle\Java\javapath\
  3. C:\Program Files (x86)\Common Files\Oracle\Java\java8path\java.exe
  4. C:\Program Files (x86)\Common Files\Oracle\Java\java8path\

The below showcases that I do have a working JRE, and I provided the correct location of the JRE. Command 1:

java --version

Output 1:

java 22.0.1 2024-04-16
Java(TM) SE Runtime Environment (build 22.0.1+8-16)
Java HotSpot(TM) 64-Bit Server VM (build 22.0.1+8-16, mixed mode, sharing)

Command 2:

where java

Output 2 :

C:\Program Files\Common Files\Oracle\Java\javapath\java.exe
C:\Program Files (x86)\Common Files\Oracle\Java\java8path\java.exe

Would really appreciate ANY help!


Solution

  • Its not the JRE which got converted to exe. It is trying to find java runtime which is is installed in the system, its not getting that and giving this issue.

    Try the below 2 points -

    1. Check in the the system settings, if your JAVA_HOME is set properly and Path is mentioned till <JAVA_HOME>\bin folder. Go to CMD and type PATH. It will show you the details. From your output it looks fine to me.

    2. Do you have JDK installed as exe or Configured as Portable JDK in your system.

    If your JDK is not installed, try to install that as "exe" file, it will solve your problem.