If JVM<JRE<JDK why if I install the last version of JDK, a specific JRE installation is also required to make games work?

AleMaffe

Is JRE contained in JDK installation or I'm wrong? Why do I have to install specifically the JRE in order to play games based on Java, for example Minecraft?

rzwitserloot

If JVM<JRE<JDK

This isn't true, but JRE < JDK is more or less true.

a specific JRE installation is also required to make games work?

Actually, JREs are dead; java8 is now over 5 years old and is the last version where a JRE is the intended distribution model. The JRE model works as follows:

  • The developer installs a JDK and builds their java application with it.
  • The developer ships a bunch of jar files to the end user.
  • The end user will download a JRE from e.g. oracle and installs it. That user and oracle work together to do the maintenance on this (keep it updated for example to close a security leak in the JRE); developer is no party in this at all.

The reason the JRE exists at all is because it can be simpler and smaller, and its download and maintenance can be streamlined for end users and not developers.

This is also why a game would want a JRE: A JDK doesn't, as a rule, ship with managed security updates because a JDK is targeted at developers who are assumed to know better and keep it up to date. (They don't, of course, but that's another issue).

This model is obsolete. The new model is:

  • The developer installs a JDK and builds their java application with it.
  • They use jlink or other installer creation tools to produce an installer which is then shipped to the end user. jlink can make a custom cut-down version of the JDK without developer tools and with only those parts of the java libraries that are needed. Even smaller than a JRE, in other words.
  • End user installs. They have no arrangement with oracle or any other 'JRE provider' and do not need a JRE on their system; even if one is there, it won't be used. Distribution of any updates (including security updates) to the cut-down java runtime being used are entirely the responsibility of the app maker.

That latter model is in practice how most 'runs on the desktop' java software was distributed anyway: asking users to install a JRE is an annoyance, and is also unreliable: What if your app doesn't run on jre8 because you wrote it for jre6 and something updated in 8 breaks your app, but the end user updates their jre?

Now that latter model is the official model, which makes your question mostly moot.

Minecraft presumably needs to update its deployment.

NB: Some companies, such as Azul, still distribute something they call 'jre11'. These distributions are meant for shops that cannot easily transition away from the old distribution model of 'user maintains a JRE, developer distributes just jar files', but do want to use new java features. Oracle doesn't distribute these, and this distribution model is no less obsoleted. 'obsolete' doesn't mean 'impossible', just 'not recommended / you need to find some time to move away from it / definitely do not do this for new projects'.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related