Firebase Tools and Java 11
Asked Answered
S

5

16

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

Salmon answered 28/4, 2022 at 15:41 Comment(0)
S
12

To install Java SE:

Go here.

  1. Scroll down to find your product. I chose Java SE 11. (Oracle will probably list later versions as they are made available.)
  2. Choose your operating system. I chose MacOS.
  3. Choose your file set. I chose the DMG installer.
  4. Download your chosen file set.

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

Salmon answered 28/4, 2022 at 15:41 Comment(6)
the link you posted says "64-bit Java for Windows Version 8 Update 333". I understand that the JRE is version 8 and JDK is version 11, but I can't understand why that is.Trouper
Which link? The main Download page?Salmon
yes, the main Download pageTrouper
That page is apparently sensitive to the user's OS. I use Mac, so I'm not seeing the same thing. I think that's okay, because it still says 'Version 8 Update 333' for me. I believe that means 'Java Runtime Environment 8'. It does not imply anything about the JDK. If you want JDK 11, I think that you would need to download it from a different page: oracle.com/java/technologies/downloads/#java11Salmon
Can you please tell us HOW you installed the JavaSE11?Earthstar
Added installation instructions to the answer.Salmon
T
7

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/

Trouper answered 3/6, 2022 at 20:42 Comment(2)
super this did the trick for me. What I don't understand that I have to install a Java development kit to run emulators in firebase??Jourdan
that is a good question that I would like to understand too!Trouper
S
2

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
Social answered 11/7, 2022 at 12:5 Comment(0)
C
1

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.

Creamer answered 17/6, 2022 at 17:46 Comment(2)
It sounds like you're saying that it shouldn't be up to developers to find the right Java download to use with firebase-tools once past Java 8. Instead, firebase-tools will include the runtime intended for their application. So in the future, maybe the step of finding the correct Java version will no longer be necessary.Salmon
@JosephZabinski Yes, that is how it's supposed to work. But, in my experience not everyone has caught on to this. Maybe the authors of firebase-tools have different plans here. The runtime environment has to come from somewhere, so I'm assuming the authors have an idea of where end users should get the runtime environment.Creamer
P
0

Worked for me in 2024:

Just do brew install java, if may just work. If not, follow this answer to add a symlink, then it'll work.

Pus answered 13/6 at 6:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.