JDK upgrade - How?


(Ruth Berge) #1

I used Cask for Java so that I could use an old version I need plus a new one. I think I followed this issue but also I don’t have all the documentation of what I did before and I recall that there were some parts that were unclear.

Now I would like to upgrade to the latest build of that version of Java. I am not sure whether to do this in jenv or home-brew cask. I don’t see a way to do this in jenv. So back to home-brew. When I try this is what I get
rror: Unknown command: java
2345:/ mycomputer$ brew cask audit java
audit for java: passed
2345:/ mycomputer$ brew cask install java
Warning: Cask ‘java’ is already installed.

To re-install java, run:
brew cask reinstall java
4512:/ mycomputer$ brew cask reinstall java
==> Caveats
This Cask makes minor modifications to the JRE to prevent issues with
packaged applications, as discussed here:

If your Java application still asks for JRE installation, you might need
to reboot or logout/login.

Installing this Cask means you have AGREED to the Oracle Binary Code
License Agreement for Java SE at

==> Satisfying dependencies
==> Downloading <link to download of java 9>
######################################################################## 100.0%
curl: (22) The requested URL returned error: 404 Not Found
Error: Download failed on Cask ‘java’ with message: Download failed: http://download.oracle.com/otn-pub/java/jdk/9+181/jdk-9_osx-x64_bin.dmg
1=44:/ mycomputer$

I did use jenv to delete the previous idk version 8 that I had…

Here is what I had done before the above part…
Note that when I try to install it is calling the OLD version of java. 144 was the build I originally installed and for version 8 the newest build is 152.

7234:/ mycomputer$ jenv remove oracle64-1.8.0.144
JDK oracle64-1.8.0.144 removed
7823:/ mycomputer$ jenv javahome
jenv: version `oracle64-1.8.0.144’ is not installed
/Users/me/.jenv/versions/
9876:/ mycomputer$ brew cask search java
==> Exact Match
java :heavy_check_mark:
==> Partial Matches
charles-applejava java-jdk-javadoc java8 netbeans-java-se
eclipse-java java6 :heavy_check_mark: netbeans-java-ee yourkit-java-profiler
2344:/ mycomputer$ brew cask home java8
2344:/ mycomputer$ brew cask install java8
==> Caveats
This Cask makes minor modifications to the JRE to prevent issues with
packaged applications, as discussed here:

If your Java application still asks for JRE installation, you might need
to reboot or logout/login.

Installing this Cask means you have AGREED to the Oracle Binary Code
License Agreement for Java SE at

==> Satisfying dependencies
==> Downloading < link to download of old build of version 8 >download.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144
######################################################################## 100.0%
curl: (22) The requested URL returned error: 404 Not Found
Error: Download failed on Cask ‘java8’ with message: Download failed: <same address of old Java 8 build 144>
1144:/ mycomputer$ brew cask reinstall java8
==> Caveats
This Cask makes minor modifications to the JRE to prevent issues with
packaged applications, as discussed here:

If your Java application still asks for JRE installation, you might need
to reboot or logout/login.

Installing this Cask means you have AGREED to the Oracle Binary Code
License Agreement for Java SE at

==> Satisfying dependencies
==> Downloading < link to old build 144 of java 8:>
######################################################################## 100.0%
curl: (22) The requested URL returned error: 404 Not Found
Error: Download failed on Cask ‘java8’ with message: Download failed: Link to old build 144 of java 8
1144:/ mycomputer$ brew cask remove java8
Error: Cask ‘java8’ is not installed.


(Jacob Ledbetter) #2

Try updating java through your settings tab.


(Ruth Berge) #3

I did that. This upgrades the Java internet plugin only. I’m still not seeing how to upgrade the java installed by home-brew which is jdk.


(Ruth Berge) #4

I also tried removing my proxy and doing this from my own local home network and from within the company network. I still get this error. I suggest that there is a problem. I can not access that URL directly from a browser. I get
curl: (6) Could not resolve host: download.oracle.com
Error: Download failed on Cask ‘java’ with message: Download failed:

Sorry!

In order to download products from Oracle Technology Network you must agree to the OTN license terms.

Be sure that…
Your browser has “cookies” and JavaScript enabled.
You clicked on “Accept License” for the product you wish to download.
You attempt the download within 30 minutes of accepting the license.

From here you can go…

Back to Previous Page
Site Map
OTN Homepage

here is the url that home-brew is trying: http://download.oracle.com/otn-pub/java/jdk/9.0.1+11/jdk-9.0.1_osx-x64_bin.dmg


(Ruth Berge) #5

note in my original post I said “followed this issue” with the intent of posting a link to a blog post on hankue-it and/or a stack overflow discussion. I didn’t end up posting that partly because this blog only lets me enter two urls in a post. I had to go back through and hand edit the post to remove all the url stuff. I failed to correct that part of my sentence. I was referring to a blog about using home-brew to support multiple java versions.


(Jacob Ledbetter) #6

Java may need to be updated with the correct URL in homebrew. Use the contributing website to help update java.


(Ruth Berge) #7

Thanks! What I did already was download and install java from Oracle. I also set my java home the old fashioned way plus I set in jenv. I deleted the version information from jenv. I deleted the folder for java 8 under the Caskroom. (I know jenv is a different program but just mentioning it). My Caskroom for java now has a folder for an even older java version which I need and a folder simply called “java”. the Java folder contains one empty folder called .metadata. Using the Cask commands I see brew cask info java
java: 9.0.1,11
https://www.oracle.com/technetwork/java/javase/downloads/jdk9-downloads-3848520.html
Not installed
From: https://github.com/caskroom/homebrew-cask/blob/master/Casks/java.rb

I’m just pointing out what I see. I may delete the java folder but for now I really don’t understand what state it is in. I do have java updated, just not using any variant of home-brew.


(Jacob Ledbetter) #8

Hey, @MikeMcQuaid is our java bonk?


(Mike McQuaid) #9

Java doesn’t seem to be broken. You can install Java 8 from caskroom/versions.


(Jacob Ledbetter) #10

Ok so brew cask install java?


(Ruth Berge) #11

I was upgrading. I was trying to install java 8 update 151 or 152. I ended up installing java 9.

Maybe it works for Mike and he could share the secret potion ? or try to replicate my steps? I think i included everything.
Also can i just delete the java 8 folder from Caskroom?

Thanks for the help.


(Mike McQuaid) #12

brew tap caskroom/versions; brew cask install java8


(George Adams) #13

I would recommend checking out https://github.com/AdoptOpenJDK/homebrew-openjdk where you can go and grab prebuilt openjdk binaries for macOS!

It’s just a case of using:

brew tap AdoptOpenJDK/openjdk
brew install <version>

Where version is:

  • adoptopenjdk-openjdk8
  • adoptopenjdk-openjdk9
  • adoptopenjdk-openjdk10

(THNIAN) #14

Thanks to all :yellow_heart: