2

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?

AleMaffe
  • 23
  • 6

2 Answers2

2

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'.

rzwitserloot
  • 44,252
  • 4
  • 27
  • 37
  • So, if I understood well, you mean that some games don't recognize JRE inside JDK because they don't trust its """format""" or something that, and that's because of security problems which may occur because the security update is not automatic? P.S. Why should my question be moot? Since I was a child, the only way to play Minecraft on a new computer just bought from the shop, is to install the JRE manually... .-. – AleMaffe Dec 16 '20 at 15:59
  • There __is no more JRE__. The JDK is just what it is. When you say 'the JRE inside the JDK', what do you think that means? My answer and @ZackMacomber are saying the same thing: Starting with java9, JRE is no longer a thing. For what it is worth, a JDK can run java apps just fine, but minecraft evidently doesn't want it, possibly because unlike the JRE downloads of old (as they are no longer a thing) they don't update without explicit action by the developer. – rzwitserloot Dec 16 '20 at 16:22
  • @AleMaffe your question has been answered. You are now mutating it into 'how do I run minecraft on my PC? What should I download?' which is a different question. – rzwitserloot Dec 16 '20 at 16:24
  • Ah good, now this answer is more clear. I didn't understand that step. I was talking about minecraft just for example, considering it works with Java, to deepen the topic, anyway, thank you for your time ;) – AleMaffe Dec 17 '20 at 12:30
  • Good evening Mr @rzwitserloot , sorry to bother you, but if you have time, may you take a look at my last question about creating PDFs with iText7? Noone seems to have an answer to it, and I seriously don't know what to do!!! (Sorry for the spam and thank you so much!) – AleMaffe Jan 12 '21 at 15:42
0

Is JRE contained in JDK installation?

Pre Java 11 it was but post Java 11 it isn't

Why do I have to install specifically the JRE in order to play games based on Java, for example Minecraft?

Looks like from Java 11 on things have changed: https://stackoverflow.com/a/53733414/1098361

Zack Macomber
  • 6,237
  • 12
  • 49
  • 95
  • Man, you and rzwitserloot are saying two different things... He says JRE is still in JDK, but the game won't recognize it because of security problems. Where did you find out that post java11 it isn't contained? .-. – AleMaffe Dec 16 '20 at 16:07
  • @AleMaffe The link I put in my answer shows how post-java11 it isn't contained (I guess more accurately post-java10 now that I think about it). – Zack Macomber Dec 16 '20 at 18:21
  • ah yes, now I understood, thank you for your precious time ;) – AleMaffe Dec 17 '20 at 12:22