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.
Related
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.
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.
When the JDK already includes JRE for the execution of code, why do I have to download JRE separately to execute my java code is the doubt that's bothering me
As far as I remember this depends on your OS, browser and JDK version.
Eg. if you're using a 64-bit OS and installed a 64-bit JDK, but are using a 32-bit browser, then you might have to install a 32-bit JRE if you need Java support in the browser.
Otherwise a separate JRE installation should not be required, since the JDK installation also installs the JRE.
JRE: Java Runtime Environment. It is basically the Java Virtual Machine where your Java programs run on.
JDK: It is a group of utilities one needs to develop programs in Java including JRE, and the compilers and tools (like JavaDoc, and Java Debugger) to convert the source code into bytecode.
Refer: http://javarevisited.blogspot.de/2011/12/jre-jvm-jdk-jit-in-java-programming.html
Similar, post is there on below link as well.
What is the difference between JDK and JRE?
So I'm trying to get the latest version of Java. When I run:
java -version
I get:
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)
When I run:
javac -version
I get:
javac 1.6.0_65
Now I've just downloaded and installed JDK 8. When I go into System Preferences --> Java --> Update, I see:
Your system has the recommended vesion of Java.
Java 8 Update 05.
I guess I have a few questions:
1) Don't I want the JDK and my version of Java to match up?
2) Why does my Java Control Panel claim I have Java 8, but my work in the terminal (when checking my Java version) says otherwise?
Thanks for the help,
Mariogs
The probably "simple" answer is you have two versions of java installed. On the command line you currently use 1.6. Thus the old one is active. In system preferences you see the version of java 8.
Windows:
You can change the version of the command line to java 8. Set PATH environment variable and JAVA_HOME or via windows preferences. I recommend the first one.
Mac: /usr/libexec/java_home is the starting point for switching java versions on the command line. Check out this post to understand how to handle different java versions on the Mac. IMHO this answer is a good solution.
The Java Platform offers both the JRE and the JDK in order for users to run Java programs. The JRE stands for the Java Runtime Environment, and the JDK stands for the Java Development Kit.
The JDK is meant for Java developers - that is, those who build applications/write programs in Java. It contains tools that are needed for Java coding, including -javac to compile programs.
The JRE is meant for regular users - those who only need to run Java programs on their computer and are not interested in development.
The reason for the discrepancy in your case is because you're looking at the JRE and JDK and trying to compare the two. The current JDK that you have is Java 8, whereas the current JRE that you have is 1.6.0_65. It is problematic that your JRE version does not match your JDK version, but without your PATH variable or other information about your install, we can't help you fix your installation.
1) Yes, if you use the JDK at all, you want the JRE (runtime environment) to come from the JDK (development environment) (a JDK necessarily includes a JRE).
2) Likely your path variable is set so that you invoke Java from your Java 6 installation; you need to find the equivalent for your Java 8 installation and set the path for that. Without information about your operating system, we can't help you do that.
We should know the reason for this
Our OS comes with a predefined (built-in)set of tools and utilities. When we try to execute the command e.g. cls in the Windows command line then it is already present in system path variable and os will refer the corresponding binary of cls to execute the command.
However, when we install any third party tool/software then path variable is not updated accordingly.
When we install different versions of java on your system then installations go to different directories. E.g. JDK installation directory for Windows will be
C:\Program Files\Java\jdk1.8.0_161
Similarly, JRE installation directory for Windows will be JDK installation directory for Windows will be
C:\Program Files\Java\jre1.8.0_161
We need to update the path variable of OS to point to the appropriate directory. If we set the path of JDK then it will execute a binary from JDK bin directory.
Solution
we need to update JDK or JRE version specific directory location into PATH Environment variable.
Let me see if I can clear it up for you.
1)Yes, arguably you nearly want this to be true.
2)It could be few things, but most likely that a previous instillation was not properly removed. So one gets called instead of the other.
I have a project for school written with jdk 1.7. This application will be distributed to other groups and we want to document the necessary user system requirements. I'm assuming that the user will need the jre corresponding to jdk 1.7. Is this correct? Or what is the best recommendation for the user? The latest jre version?
JRE 1.7 + version will be good to use.
On a side note:-
It is nothing like that your Java 6 code will not run on Java 7 code. The difference is that the speed increases when running them on later runtimes. This is because Java is constantly evolving, not just the language but also the JVM (Java virtual machine). SO it would be an added advantage of speed if you choose to use the later versions.
Latest JRE version which will be 1.7+ is good.
JRE 1.7 version.
If you want to target, let's say, a Java 6 VM, then you can do that with the Java 7 SDK tools. You can specify which target VM you wish to support, but you have to know that a version 6 VM might not support all the features a version 7 VM will.
Note that if you use the -target and/or the -source options to javac, you may be able to compile with a recent JDK and run with an older JRE.