Find JRE Itself

Generated exe will find JRE by itself when it runs


Introduction

Generated exe files can find JRE on host by many ways.

  • From registry (Windows)
  • From 'java' symbol link to find JRE directory (Linux)
  • From environment JAVA_HOME or JRE_HOME (Windows and Linux)
  • From specified path in configuration file (Windows and Linux)

From Configuration

Generated exe can have a configuation file. In the configuration file, a line 'jvmdll' is used to specify a JRE.

  • On Windows, 'jvmdll' should be followed by a path to 'jvm.dll', e.g.: 'C:\jdk1.5\jre\bin\client\jvm.dll'.
  • On Linux, 'jvmdll' should be followed by a path to 'libjvm.so', e.g.: '/usr/java/jdk/jre/lib/i386/client/libjvm.so'.

'jvmdll' can also be followed by a 'relative path'.

  • See 'jvmdll' page for details of 'jvmdll' configure item.
  • See Configuration page for what is configuration file.

From Registry on Windows

If JRE is normally installed on Windows, it will write its information at registry 'HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment'. So generated exe will find the JRE from the registry.

 On 64 bits of Windows, both 32 bits of JRE and 64 bits of JRE can be installed at the same time. They will not conflict with each other in registry.

32 bits of JRE is for 32 bits of generated exe to run. 64 bits of JRE is for 64 bits of generated exe to run.

  • See Compatibility page for details of compatibility.
  • To find JRE from registry can be disabled by 'jre_order', 's' stands for 'SUN JRE in Regirstry'.

From 'java' Symbol Link on Linux

If JRE is normally installed on Linux, it will write a symbol link at '/usr/bin/java' points to installed 'java' command. Generated exe file will find the JRE directory through the 'java' symbol link. Then generated exe will find the 'libjvm.so' by itself in the JRE directory.

  • To find JRE from 'java' symbol link can be disabled by 'jre_order', 's' stands for 'From java Symbol Link'.

From Environment JAVA_HOME or JRE_HOME

Generated exe files can also find JRE through environment JAVA_HOME or JRE_HOME.

JAVA_HOME and JRE_HOME are the same for generated exe. If any one of them points to a JDK or JRE directory, generated exe can find the JRE.

  • To find JRE from environment can be disabled by 'jre_order', 'e' stands for 'From Environmet'.

About 32/64 Bits of JRE

32 bits of generated exe can run with 32 bits of JRE only.

64 bits of generated exe can run with 64 bits of JRE only.

  • See Compatibility page for details of compatibility of 32 bits and 64 bits.

JRE Find Order

By default, generated exe will find JRE in this order:

  1. Configured 'jvmdll' in configuration file
  2. Registry to find installed SUN JRE (Windows) / or 'java' symbol link (Linux)
  3. Registry to find installed IBM JRE (Windows)
  4. Environment JAVA_HOME or JRE_HOME

With a configure item 'jre_order', the search order can be changed, or some of them disabled.

  • See 'jre_order' page for details of JRE Find Order.

Comments

Support For JAVA 17

Dear Team,

We are using licenced version of JAR2EXE but we are not able to use is futher since it doesn't support latest JAVA LTS version viz 17. Can you please help us with the timeline when can we expect it to be supported so that we plan it accordingly. 

Not tested, but by default it is compatible

JAVA 17 is not tested with Jar2Exe, but by default, future version of Java is compatible with Jar2Exe. Because Jar2Exe does not use specific feature of certain version of JAVA. If you meet problem, please contact me before we finished the tests.

Add new comment