7

We are using Install4j 7.0.6 and set the Java minimum version to "10.0.1". We are bundling a Java 10.0.1 into the media file. When we replace the included JVM with a Java 9 VM our Application still starts. Are we just missunderstanding the function for the Java minimum version or are we using the wrong version format or is it broken in Install4j 7.0.6?

Gregor G.
  • 189
  • 8

2 Answers2

2

The bundled JRE will always be used, regardless of the minimum version. The minimum applies to installed JREs that are checked by the search sequence.

Ingo Kegel
  • 46,523
  • 10
  • 71
  • 102
  • Ok good to know thanks. But is there a way to make sure that no one swaps out the bundled JRE after the installation ? – Gregor G. Aug 19 '19 at 08:23
  • In the installer, you could write a marker file in the JRE directory and check that at startup. – Ingo Kegel Aug 19 '19 at 10:35
  • Is there a way to make sure that only the bundled JRE is used and when someone deletes the bundled JRE it just doesnt start? – Gregor G. Aug 19 '19 at 11:21
  • You can delete all elements in the JRE search sequence on the "General Settings->Java version" step for that purpose. – Ingo Kegel Aug 19 '19 at 13:22
1

From what I can make out, the purpose of the minimum Java version parameter is to tell the Java compiler that Install4j uses to compile scripts what the Java target is level should be.

The manual includes a warning that you should not include an embedded JRE that is less than the target level because that could cause runtime errors. The implication of that warning is that Install4j doesn't check this.

Here's what the manual says:

The design time JDK is used for the following purposes:

  • Code compilation: install4j uses a bundled eclipse compiler, so it does not need this functionality from a JDK. However it needs a runtime library against which scripts entered in the installer configuration are compiled. The version of that JDK should correspond to the minimum Java version for the project. If that minimum Java version is lower than the version of the design time JDK, runtime errors can occur if you accidentally use newer classes and method.

  • ...

There probably isn't a reliable way for Install4j to check the version of the JRE you provided for embedding. At any rate, the manual implies that this is not checked.

Community
  • 1
  • 1
Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
  • Are we talking about the same version? I refer to the minimum version under General Settings > Java Version. And in the Install4j IDE above this option is said " Please define the version requirements for the JRE that your application will be started with" which means to me it should check the JRE Version when starting – Gregor G. Aug 16 '19 at 08:05
  • I'm not sure. I don't actually have a copy of Install4j to play with. – Stephen C Aug 16 '19 at 09:19