Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Please add this new jdkPreference option

Help
Anonymous
2012-11-13
2013-06-12

  • Anonymous
    2012-11-13

    To author of launch4j,

    I had installed JRE 1.6 and JRE 1.7, but EXE built from launch4j always use the newest version, which is JRE 1.7. I want my EXE to use JRE 1.6 only. Is there a way to do this?

    I had set registry key: HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\CurrentVersion to 1.6.
    I also had set JAVA_HOME environment variable to my JRE 1.6 installation folder.
    I also had made sure in PATH environment variable, I set %JAVA_HOME%\bin in the first entry, so when I invoke java.exe -version, it will call the JRE 1.6's java.exe.

    But in the end, EXE built from launch4j always use JRE 1.7. I know that for sure by calling System.out.println(System.getProperty("java.version")); in my EXE code.

    It seems there is no JDK Preference option to use only JRE from JAVA_HOME environment variable or from b]HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\CurrentVersion registry key.

    So I suggest to add a new JDK Preference option to use older JRE (if there are more than one JRE) or JRE from JAVA_HOME or the registry key in future version.

     
  • Grzegorz Kowal
    Grzegorz Kowal
    2012-12-05

    Please read the documentation:

    … you may also specify the <maxVersion> to prevent it from using higher Java versions. Launch4j will always use the highest version available (in the min/max range of course)…

    so, minVersion = 1.6.0, maxVersion = 1.6.0_99.

    -Grzegorz