java – Why does Eclipse use an old JRE by default?
Eclipse is itself a java app.
Like any java app it needs a JVM to run itself on. And like any java app, it is written ‘targeted’ at a specific JVM release, which means it will not run on anything older than the targeted release, and it should, but might not necessarily run on anything newer.
So, keep this in mind:
- You have one JDK that you run on eclipse on.
- You have, completely unrelated, a JDK that you compile the app against, and run your compiled app on; an app you developed in eclipse1, and
- There is absolutely no reason whatsoever that those 2 should be the same JDK. In fact, it is a really bad idea to do that!
Separately:
JRE? That does not exist and hasn’t since java 8. The concept is dead. The JRE concept is that the end user of the machine contracts with Oracle or some other vendor to install and maintain a JRE, and then the end user separately contracts with some vendor of an app, where the app-vendor takes no responsibility or effort whatsoever to ensure a JRE is available: That’s oracle/enduser’s job. That is dead and has always been dead; it’s official since java9 – i.e. over 10 years at this point. In other words, as per the preferred way to distribute java apps, Eclipse must itself install a JDK version that it has tested itself against, and maintain it, so it is not at all weird that [A] eclipse’s installer installs a JDK and [B] that it is version 17.
So what should you do
Take the JDK that eclipse installed and leave it alone. It’s there for the benefit of eclipse itself.
Install the JDK you want yourself. Then tell eclipse about that JDK, and that you want that to be the default. Sure, go with JDK23. Why not? Then.. go forth, and program awesome things!
[1] Eclipse has no problem dealing with you having loads of JDKs installed; each eclipse project can be configured to compile against and run on a different one if for some reason you want that. This isn’t crazy, either. You can have an app that is designed to run on JDK11 still, and one that is designed for JDK23, developed in tandem, why not? Eclipse will let you do that.
Read more here: Source link