Java JDK, JRE, JVM [duplicate] - java

This question already has answers here:
How can I get Java 11 run-time environment working since there is no more JRE 11 for download?
(4 answers)
Closed 1 year ago.
I was trying to update my jave version and got confused a little bit. I have jdk 10, which I used, and also have Java Platform 8, which have "configure java" app, so what should I do now, if you go to java.com they're offering you to install java 8 only, do I need to delete old java 8 and jdk 10 and then install jdk 11 from oracle.com? Does it have jre in it? Can I run for example apps like Minecraft if I do that and write code too? Also what should I install: oracle jdk or open jdk then?

The Java JDK is Java Development Kit, which installs everything you need to write, compile, and run Java code and programs. It includes the Java JRE, which is the Java Runtime Environment. It only has what you need to run Java apps/programs. The download you're being offered when you go to java.com is the JRE. The JVM is the Java Virtual Machine, which is the engine for running Java programs and comes with both the JRE and JDK.
If you're looking to run and develop Java programs, all you need to do is install the JDK. I would suggest uninstalling any previous versions of Java you have for security reasons, as support could've been dropped for them. As for OpenJDK and Oracle JDK, OpenJDK is the open source implementation of Java, and other JDKs like Oracles are built on top of it. The OpenJDK does not require a license to use while others might, depending on your use case.

Related

Firebase Tools and Java 11

This question falls somewhere between Firebase Tools, MacOS and Java. Probably 75% Java, 20% Firebase Tools and 5% MacOS.
Starting with v10.5, firebase-tools started stating that 'Support for Java version <= 10 will be dropped soon in firebase-tools#11. Please upgrade to Java version 11 or above to continue using the emulators.'
I run macOS v11.6.5 on a Macbook Pro from mid-2014. When I go to Java's Downloads page, it recommends Java 'Version 8 Update 331'. Not Java 11.
Information on downloading Java 11 seems to be scarce. Oracle's page of certified configurations includes MacOS 11, but I can't find anywhere obvious where Java 11 can be readily downloaded.
A big part of the problem seems to be the terminology used. If I run java -version, I get:
java version "1.8.0_331"
Java(TM) SE Runtime Environment (build 1.8.0_331-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.331-b09, mixed mode)
Okay, I have build 1.8 of the Java Runtime Environment, aka the JRE if you are a Java enthusiast. That is apparently what is triggering the warning in Firebase Tools.
There is also a Java product out there called 'Java SE 11'. The product itself is ambiguous, but the checksums all say 'SDK'. (A Software Development Kit: a thing that enables developers to develop Java programs. The name doesn't imply a Runtime Environment: a thing that enables Java to run on an operating system.) There is an article out there which claims that, if you install Java SE 11 and run java -version, it will spit out java version "11.0.7". That will probably satisfy Firebase Tools.
But Oracle's release notes say: 'In Windows and macOS, installing the JDK in previous releases optionally installed a JRE. In JDK 11, this is no longer an option.' No longer an option... as in now you implicitly get JRE 11 with SDK 11? Or as in the SDK and JRE are now fully divorced, and the JRE must be ferreted out of its hiding like a wild beast?
UPDATE 6/5/22: Java's checksums page now says 'JDK', and I guess that is better than 'SDK' because it implies 'Java Development Kit', which this Wikipedia article claims to include both a JRE ('java') and SDK (most of the other files).
To install Java SE:
Go here.
Scroll down to find your product. I chose Java SE 11. (Oracle will probably list later versions as they are made available.)
Choose your operating system. I chose MacOS.
Choose your file set. I chose the DMG installer.
Download your chosen file set.
5. Do whatever is required by your platform to install Java SE using the downloaded file set from #5.
After installing Java SE 11, java -version now says "11.0.14" and Firebase Tools is now satisfied. My best guess is that JRE 11 was implicitly downloaded, and that developers need to start ignoring the main Download page used by everyone else. (Why didn't the main Download page recommend Java 11 from the start?) Hopefully someone will see this question and clarify whether in the future, the 'Java SE' product implicitly includes both the JRE and SDK, and that the numbering system will always encompass both. In other words, hopefully when someone says we need 'Java 11', it means that we need to download SE 11, containing JRE 11 and SDK 11.
This link has a JDK installer that solved my problem today. I needed to close and reopen all my VScode windows to get it to work.
https://www.oracle.com/java/technologies/downloads/
With latest versions this error appears: !! emulators: firebase-tools no longer supports Java version before 11. Please upgrade to Java version 11 or above to continue using the emulators.
You can download Java SE Development Kit 18 from this link. Just choose your operating system, download and install the file. When installation is complete you need to restart you terminal and voila it works now:
firebase emulators:start
But Oracle's release notes say: 'In Windows and macOS, installing the JDK in previous releases optionally installed a JRE. In JDK 11, this is no longer an option.' No longer an option... as in now you implicitly get JRE 11 with SDK 11? Or as in the SDK and JRE are now fully divorced, and the JRE must be ferreted out of its hiding like a wild beast?
With Java 8 and earlier, the end user of a Java application was responsible for providing a Java runtime environment for the application to run on. This is what the JRE was for. The user would have to install this runtime environment on their system in order to run Java applications. This is also why the https://www.java.com/en/download/ page recommends Java 8 (the JRE), which was the last version of Java where an end-user should concern themselves with installing a runtime environment.
Starting from Java 9, it is now the application distrubutor's responsibility to provide a Java runtime that can run the application. So, there are no more JREs.
The application developer should use jlink, which is a tool included in the SDK, to create a 'runtime image' (essentially a bespoke JRE to run a single application), that can be used to run the application, and bundle that runtime image with the application. The jpackage tool can also be used to create application images (including a runtime image), as well as installers.

Is it impossible to run Java Web Start application using "SDKMAN!"

Hello🙂 I'm not familiar with Java. I'm trying to run Java Web Start (javaws command) using SDKMAN! to use a Supermicro's legacy IPMI application.
It seems that Oracle Java 8 was able to run javaws but it is removed since Java 9. It also seems that SDKMAN! removed Oracle Java due to Oracle's licensing problem.
So I assume that there is no way to install javaws using SDKMAN! currently and we have to install the old Oracle's Java 8 manually out of SDKMAN!. It this right assumption? Thank you.
JavaWebStart has been developed closed source by Oracle and therefore is only part of the Oracle JDK. Since Oracle stopped JavaWebStart it is even in the Oracle JDK not provided for Java 11+.
In general you have 3 ways you can go:
Use an old Java 8 build from Oracle that does not has fixes for security issues of the last 18 month
Buy support for Java 8 at Oracle and use an actual build of the Oracle JDK version. 8
Install AdoptOpenJDK 8 LTS version on windows and select to use IcedTea-Web in the installer
Use OpenWebstart in combination with any Java 8 or Java 11 JRE / JDK. That can provided by SDKMAN for example

Is java -version telling me about the JRE or the JDK?

I had only a JRE and now I also downloaded a JDK; they are listed in control panel as:
Java 8 update 121, Java SE Development Kit 8 Update 121
so I guess the JRE inside my JDK and the other JRE are the same version;
When I write in cmd java -version; is it the original jre or the jre inside the jdk's folder?
Also i was thinking, considering i have 2 identical JRE, can i delete the old one or is it bad practice?
It relates to whatever's first on your path, simple as that. Every executable follows the same resolution rules.
On unix, you can use this to see where it's coming from
which java
On Windows it's
where java
java -version tells the JDK version and yes, you should only keep the latest production version of JRE and JDK in the system. No need for having multiple libraries as any application can have only one JRE associated with it.

When JRE was completely discontinued as a separate offering?

Starting from Java 9 the module system was introduced, making provision of JRE separately redundant.
Through, it seems that it was still possible to download it. For example, from here now Java 9 archive
Also, here it's only stated that :
Restructure the JDK and JRE run-time images to draw a clear distinction between files that developers, deployers, and end-users can rely upon and, when appropriate, modify, in contrast to files that are internal to the implementation and subject to change without notice.
The new image structure eliminates this distinction: A JDK image is simply a run-time image that happens to contain the full set of development tools and other items historically found in the JDK.
So no talk about complete removal.
From : jdk-9
When you install jdk-9, public jre-9 also gets installed automatically.
Also, I was thinking that started from Java 9 the custom runtime should be always created using the jlink, but it seems it's enforced now only from Java 11.
From the release notes of Java 11 here Oracle JDK release notes:
In Windows and macOS, installing the JDK in previous releases optionally installed a JRE. In JDK 11, this is no longer an option.
In this release, the JRE or Server JRE is no longer offered. Only the JDK is offered. Users can use jlink to create smaller custom runtimes.
But then I can find a lot of discussions like those:
Where is Java 9 JRE?
Create jre from OpenJDK Windows
Why did Java 11 JRE not install with JDK and where is the download for just the Java 11 JRE?
Is there an openjdk-11-jre?
Is this the case and it is not possible to download JRE directly since Java 11? Or am I mixing implementations between (Oracle and OpenJDK)? Or were those discussions above misleading?
Edit: I don't need to download the jre, I could create it via jlink or use already avaialble solution, my question is more of a theoretic.
Is this the case and it is not possible to download JRE directly since Java 11? Or am I mixing implementations between (Oracle and OpenJDK)?
It is correct (mostly). From Java 11 onwards, neither Oracle JDK or OpenJDK JDK has a corresponding JRE available for public downloads.
However (and this is where you are incorrect) other distributors of Java do provide JRE downloads (or packages) as an option. Details may be found via the "Java is still free" link below.
When JRE was completely discontinued as a separate offering?
It was discontinued for the Oracle and OpenJDK distributions with Java 11. The Java 11 release notes state:
"In this release, the JRE or Server JRE is no longer offered. Only the JDK is offered. Users can use jlink to create smaller custom runtimes."
I have not been able to find any earlier public announcements from Oracle about the discontinuance of their JRE releases. (If someone finds one, please comment ...)
Please note: this is a specific answer to the specific questions asked by the OP. For more information on the status of Java vis-a-vis licenses, distributions, vendors, support, and whether or not Java is "free", I recommend that you read the following:
"Java is still free" written by the Java Champions community of independent Java leaders and experts.
It is a "live" document, and is likely to remain a good source of up-to-date information; i.e. more likely to be up-to-date than this Answer!
First of all, the question is incorrect. JRE was not discontinued. It was only discontinued by Oracle. For example, on Linux, JRE is still available*:
$ apt-cache search openjdk-11-jre
openjdk-11-jre - OpenJDK Java runtime, using Hotspot JIT
openjdk-11-jre-headless - OpenJDK Java runtime, using Hotspot JIT (headless)
openjdk-11-jre-zero - Alternative JVM for OpenJDK, using Zero
* requires repository ppa:openjdk-r/ppa
Some other JDK providers still offer JRE as well:
Azul Zulu offers JRE.
AdoptOpenJDK offers JRE.
Liberica JDK offers JRE.

Which version of JRE for JDK 11? [duplicate]

This question already has answers here:
How can I get Java 11 run-time environment working since there is no more JRE 11 for download?
(4 answers)
Closed 4 years ago.
What version of the jre is required for using jdk11?I can't find a jre version later than 8update192.
In general is a JDK version correlated to the Java language version? JDK 8 for Java 8 and JDK 11 for Java 11 ?
If I use JDK 11 can I run applications that use a lesser runtime for example 8? That is JDK 11 with Jre 8
is a JDK version correlated to the Java language version?
Yes. The number of the kit to produce apps on the Java platform, the JDK, is numbered to match the version of Java platform. 8 for 8, 11 for 11, and so on.
If I use JDK 11 can I run applications that use a lesser runtime for example 8? That is JDK 11 with Jre 8
You can use JDK 11 during development for earlier Java if your project is explicitly configured to be compiled and built for the earlier Java only.
Of course that means you cannot use features added in the later Java. But if your project is properly configured, your IDE should prevent such features from being introduced into your codebase.
What version of the jre is required for using jdk11?
There is no more separate JRE distribution. The JRE was a runtime-only environment used to run apps while the JDK was used to develop (and run) apps.
Now we have only JDK releases, as far as I know.
Oracle no longer intends for end-users to be installing a JRE or a JDK. Java Applets in a browser and Java Web Start app delivery are both being phased out, leaving the end-user with no need for a JRE. Java-based apps are expected to bundle their own Java implementation. The only folks consciously installing a JDK will be developers & server-side sysadmins.
Important:
Understand clearly the nature of the OpenJDK project, as explained in Wikipedia.
Know that Oracle has committed to feature-parity between its own branded Oracle JDK and the OpenJDK project. This commitment includes donations of previously-commercial features such as Flight Recorder and Mission Control.
Read this white paper by Oracle of 2018-03, Java Client Roadmap Update
Read the white paper Java Is Still Free, authored by key members of the Java community.
Learn about:
Java Platform Module System
jlink (JEP 282)
jpackage (JEP 343)
Here is a flowchart diagram that may help you finding and deciding amongst the various vendors providing a Java 11 implementation.

Categories