Homebrew/homebrew-cask-versions

Java8 not working anymore

micw opened this issue · 23 comments

micw commented

General troubleshooting steps

Description of issue

Oracle Java is no longer available for public download (license change). The last fix (#6934) does not work anymore.

Edit: License changed at April 16, 2019 - see https://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html for details

Command that failed

brew cask install java8

Output of command with --force --verbose --debug

curl: (22) The requested URL returned error: 404 Not Found
Error: Download failed on Cask 'java8' with message: Download failed: https://download.oracle.com/otn-pub/java/jdk/8u202-b08/1961070e4c9b4e26a04e7f5a083f551e/jdk-8u202-macosx-x64.dmg
micw commented

Possible fix: use a public mirror of the old downloadable binaries
Disclaimer: could be a legal issue.

Edit: I could fix it locally by linking to a local version of the JDK that I had downloaded previously.

I believe it would be an unauthorized distribution. Oracle is pushing to deprecate older versions of Java SE with EOL for 8 in the coming year. They moved to shorter cycles beginning with 9 and the LT release is 11. However, now the Oracle distributions are commercial and for subscribers with support. You have to accept a personal licensing agreement which requires a personally created account. I believe they're pushing for those non-subscribers to use OpenJDK, which the community support for that distribution is limited to the latest release cycles back to LT 11. OpenJDK is not patching versions prior to 11. Oracle had forewarned that all of the older versions were EOL by the coming year and that 11+ were for subscribers. Any other non-subscribers were referenced to OpenJDK. However, OpenJDK has stated that they would only provide support to include patches for 11+. I've had a couple of developers in other projects scoff at me this past year about migrating to support of newer versions. Granted, I knew very little about java in comparison to them. But, it didn't take knowing the language to understand that once EOL for those distributions commercially and their open source counterpart aren't supporting versions older than 11, then your user base of testers, users, and other developers will probably decline. I wouldn't believe that the majority of the code being migrated to 11 is incompatible. Either way, this cask would have to reference a distribution which is public and authorized for distribution by a third party. As of now, Oracle for 8 is a no and OpenJDK are non-patched since their last support of it.

The workaround is that you manually download the JDK from Oracle's website https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html (you would need to register yourself to Oracle first and then sign on to download).

Once downloaded start a local HTTP Server for the file. I did the following on my Mac machine

cd ~/Downloads
python -m SimpleHTTPServer 8000

Next edit java8.rb file (usually in /usr⁩/⁨local/Homebrew⁩/Library⁩/Taps⁩/caskroom⁩/homebrew-versions⁩/Casks/)

Change the following lines:
version to: version '8u212,b10:59066701cf1a433da9770636fbc4c9aa'
sha256 to: sha256 '9bcb4265a55e2fe63b9c58ca6c5a54eb6dda303bb69510ca6eddc2f088e41b2a'
url to: url "http://localhost:8000/jdk-#{version.before_comma}-macosx-x64.dmg",
pkg to: pkg 'JDK 8 Update 212.pkg'

If you get a SHA-256 checksum error then you can verify the file you downloaded by running the command openssl dgst -sha256 ~/Downloads/jdk-8u212-macosx-x64.dmg. This will give you the checksum value which you can put above.

Run

brew cask install java8
micw commented

Unfortunately no regular user knows that workaround. I'd suggest to modify the script to display a "how-to-download" text and let the user put the binary on a certain location to continue (and fail unless the downloaded file is there).

claui commented

Oracle had forewarned that all of the older versions were EOL by the coming year and that 11+ were for subscribers.

However, I don’t remember Oracle ever announcing that they intended to put Oracle JDK 8 behind a registration wall any time before December 2020.

However, OpenJDK has stated that they would only provide support to include patches for 11+.

Just to avoid misunderstandings: that’s what Oracle said, not OpenJDK. A few companies other than Oracle keep maintaining, producing and supporting several OpenJDK variants well below 11.

OpenJDK is not patching versions prior to 11.
[…]
their open source counterpart aren't supporting versions older than 11,
[…]
and OpenJDK are non-patched since their last support of it.

See above; several companies do offer free, public support for OpenJDK all the way down to OpenJDK 1.8.

Oracle also still maintains and patches their own (non-public) Java 8 fork, and still offers binary builds, which they call Oracle JDK 8 and which are subject to their license agreements.

I wouldn't believe that the majority of the code being migrated to 11 is incompatible.

Last time we checked, we found more than 70 formulas in homebrew-core which would not even work with OpenJDK 9+.

Either way, this cask would have to reference a distribution which is public and authorized for distribution by a third party.

I agree. Right now I’m looking into @imranzahid01’s findings and how they may help save the java8 cask quickly. If that’s not feasible, we’re going to have to find a replacement.

claui commented

@imranzahid01 Thank you for suggesting that workaround. It may work well enough as a stop-gap.

I hoped that workaround would also help save the cask for everyone. (Your comment never implied that but hey, I hoped nevertheless!) However, I’ve just realized that it may degrade UX too much for most users.

As a side note: your workaround may not need the HTTP server if you use a known file:/// URL instead of that localhost URL.

claui commented

tl;dr Let’s delete the java8 cask, ask the user to install Oracle JDK 8 manually and offer one free brew cask installable alternative.


After looking into the issue, I suggest to apply the following fixes, most critical listed first:

  1. Change the caveat for unmet Java 1.8 requirements in the core code. The new caveat should recommend manually downloading and installing Oracle’s JDK (from behind the registration wall) as a first choice. The caveat should also no longer mention the java8 cask.

  2. Discuss and pick at least one third-party OpenJDK 1.8 build (e. g. AdoptOpenJDK 8) that we’re comfortable to suggest to the user in the caveat. Even though we don’t want to endorse any specific distribution, we can’t assume that all Homebrew users are willing to deal with Oracle’s registration wall. That’s why the caveat should mention at least one third-party alternative that can be brew cask installed.

  3. Add the third-party OpenJDK 1.8 we’ve chosen to homebrew-cask-versions. (Name the cask something other than java8 so existing installs of Oracle JDK 8 will be preserved.)

  4. Back in the core code, mention the new cask in the caveat. The caveat should still present Oracle’s JDK as the preferred choice. This is because there are a few known differences between builds (pdf) (see page 5 of the PDF for details), and we’re certainly not going to check all > 70 affected core formulas for whether or not they play well with the third-party OpenJDK.

  5. Delete the java8 cask as @robertleeblairjr and others have suggested.

@Homebrew/cask maintainers: what are your opinions/preferred choices regarding step 2?

Mine is AdoptOpenJDK; it works just fine, and we already carry a few of their builds. AdoptOpenJDK has committed to supporting Java 8 until September 2023.

Also pinging @karianna, who knows a lot more about Java than I do.

gdams commented

I would recommend that you now fetch your Java from the AdoptOpenJDK cask: https://github.com/AdoptOpenJDK/homebrew-openjdk

tl;dr Let’s delete the java8 cask, ask the user to install Oracle JDK 8 manually and offer one free brew cask installable alternative.

After looking into the issue, I suggest to apply the following fixes, most critical listed first:

  1. Change the caveat for unmet Java 1.8 requirements in the core code. The new caveat should recommend manually downloading and installing Oracle’s JDK (from behind the registration wall) as a first choice. The caveat should also no longer mention the java8 cask.

Please note that users will need to pay Oracle (behind a registration wall) if they want the latest Oracle Java 8 (which is at version 8u212). It is a valid choice but as mentioned below there are multiple OpenJDK providers providing a free OpenJDK 8 (which is at version 8u212 and contains the same patches as Oracle except for one which came in late). The https://medium.com/@javachampions/java-is-still-free-2-0-0-6b9aa8d6d244 is a vendor-neutral doc explaining the options.

  1. Discuss and pick at least one third-party OpenJDK 1.8 build (e. g. AdoptOpenJDK 8) that we’re comfortable to suggest to the user in the caveat. Even though we don’t want to endorse any specific distribution, we can’t assume that all Homebrew users are willing to deal with Oracle’s registration wall. That’s why the caveat should mention at least one third-party alternative that can be brew cask installed.

The https://medium.com/@javachampions/java-is-still-free-2-0-0-6b9aa8d6d244 is a vendor-neutral doc explaining the options.

  1. Add the third-party OpenJDK 1.8 we’ve chosen to homebrew-cask-versions. (Name the cask something other than java8 so existing installs of Oracle JDK 8 will be preserved.)
  2. Back in the core code, mention the new cask in the caveat. The caveat should still present Oracle’s JDK as the preferred choice. This is because there are a few known differences between builds (pdf) (see page 5 of the PDF for details), and we’re certainly not going to check all > 70 affected core formulas for whether or not they play well with the third-party OpenJDK.
  3. Delete the java8 cask as @robertleeblairjr and others have suggested.

@Homebrew/cask maintainers: what are your opinions/preferred choices regarding step 2?

Mine is AdoptOpenJDK; it works just fine, and we already carry a few of their builds. AdoptOpenJDK has committed to supporting Java 8 until September 2023.

Also pinging @karianna, who knows a lot more about Java than I do.

Hope I helped :-), happy to keep answering questions

claui commented

Thanks @gdams and @karianna!

My preference would be to nuke Java out of existence and from everyone’s collective memory. It’s truly the language from hell, and its overlords are finicky. Never has a (collection of) cask(s) given us so many headaches, and they’re the most popular. It’s like a sick joke. Java is the tenth circle that Dante deemed too terrifying to write about.

Even though we don’t want to endorse any specific distribution

It’s worth noting that over the two next comments, it was argued that the OpenJDK builds are essentially the same (confirmed by Oracle) with different licenses. We use those for the after-8 Java casks, but they don’t provide a version for 8.

Mine is AdoptOpenJDK

I’m fine with that choice and the points above. I’m also fine with bringing back any and all AdoptOpenJDK cask you see fit for the cask-java effort.

My preference would be to nuke Java out of existence and from everyone’s collective memory. It’s truly the language from hell, and its overlords are finicky. Never has a (collection of) cask(s) given us so many headaches, and they’re the most popular. It’s like a sick joke. Java is the tenth circle that Dante deemed too terrifying to write about.

Truer words have never been spoken. 👌

AdoptOpenJDK

I'm also fine with that.

I wholeheartedly approve of this matter.

Also, I think Homebrew/homebrew-cask#16383 has just acquired even more relevance.

micw commented

@claui The "solution" was to delete the cask? IMO that will break lot of stuff with unclear cause. Replacing it with something that prints a clear statement would probably have been the better way...

I guess we can close the issue now.

claui commented

IMO that will break lot of stuff with unclear cause.

@micw Users are free to install/upgrade Java 8 from Oracle’s website manually. What did I miss?

micw commented

User experience (getting some technical error message rather than a "please use openjdk8 or install java manually" message).

claui commented

@micw As stated in #7253 (comment), I’m currently finishing up a fix for the caveat directly in homebrew-core.

This is the current draft of what the caveat will say:

${FORMULA_NAME}: Java 1.8 is required to install this formula.

Download and install Java SE 8 from:
  https://www.oracle.com/technetwork/java/javase/downloads/index.html
Or install AdoptOpenJDK 8 with Homebrew Cask:
  brew cask install homebrew/cask-versions/adoptopenjdk8
micw commented

@claui obviously I got that "Delete java8.rb" -- or it consequences -- wrong... Looks like a good solution for dependencies.

claui commented

Thanks @micw for your feedback (and for filing the issue in the first place).

Closing now in favour of Homebrew/brew#6035.
Feel free to reopen if there’s any further issue.

Oracle had forewarned that all of the older versions were EOL by the coming year and that 11+ were for subscribers.

However, I don’t remember Oracle ever announcing that they intended to put Oracle JDK 8 behind a registration wall any time before December 2020.

However, OpenJDK has stated that they would only provide support to include patches for 11+.

Just to avoid misunderstandings: that’s what Oracle said, not OpenJDK. A few companies other than Oracle keep maintaining, producing and supporting several OpenJDK variants well below 11.

OpenJDK is not patching versions prior to 11.
[…]
their open source counterpart aren't supporting versions older than 11,
[…]
and OpenJDK are non-patched since their last support of it.

See above; several companies do offer free, public support for OpenJDK all the way down to OpenJDK 1.8.

Oracle also still maintains and patches their own (non-public) Java 8 fork, and still offers binary builds, which they call Oracle JDK 8 and which are subject to their license agreements.

I wouldn't believe that the majority of the code being migrated to 11 is incompatible.

Last time we checked, we found more than 70 formulas in homebrew-core which would not even work with OpenJDK 9+.

Either way, this cask would have to reference a distribution which is public and authorized for distribution by a third party.

I agree. Right now I’m looking into @imranzahid01’s findings and how they may help save the java8 cask quickly. If that’s not feasible, we’re going to have to find a replacement.

Just because it wasn't mentioned didn't negate that it can't be done. The cask java8 is in reference to the Oracle distribution. So, it would need to be pulled or referenced to the OpenJDK. I am aware that the two Oracle and OpenJDK are maintained and distributed differently. I was just commenting to help save someone the headache of hosting the Oracle distribution, providing it through this cask, and then it being pulled because of it being unauthorized. Oracle could do the same for version 12 but they chose not to, maybe because it's the latest version. Why require it for older distributions? Either way, I switched over to AdoptOpenJDK.

claui commented

I was just commenting to help save someone the headache of hosting the Oracle distribution, providing it through this cask, and then it being pulled because of it being unauthorized.

Thanks @robertleeblairjr. Your input helped establish that the cask needed to be abandoned. That’s much appreciated.

I apologize if my comment seemed overly nitpicky. Its purpose was to make extra sure I understand everything correctly before we proceed.

I was just commenting to help save someone the headache of hosting the Oracle distribution, providing it through this cask, and then it being pulled because of it being unauthorized.

Thanks @robertleeblairjr. Your input helped establish that the cask needed to be abandoned. That’s much appreciated.

I apologize if my comment seemed overly nitpicky. Its purpose was to make extra sure I understand everything correctly before we proceed.

No worries. I didn't take offense. I find this constant changing of Oracle's licensing as annoying as many other people. Take care and have a nice day.