-1

I had a Java 19 VM installed with homebrew, but it seems it was installed as openjdk not openjdk@19. Another brew install (ffmeg seeing as you ask) decided to upgrade openjdk, which upgraded my 19 to 20.

Now I cannot find anywhere to download a version 19 JVM, and Gradle will not build with Java 20 ;-(

$ brew list
...
openjdk 
openjdk@17
...

$ brew install openjdk@19
Warning: openjdk 19.0.2 is already installed and up-to-date.
To reinstall 19.0.2, run:
  brew reinstall openjdk

https://www.oracle.com/uk/java/technologies/downloads/ has only versions 17 and 20 to download.

Duncan McGregor
  • 17,665
  • 12
  • 64
  • 118
  • Does this answer your question? [How to install specific Java version using Homebrew?](https://stackoverflow.com/questions/44632292/how-to-install-specific-java-version-using-homebrew) – aled May 15 '23 at 11:37
  • Or how to select alternative versions already installed: https://stackoverflow.com/questions/26252591/mac-os-x-and-multiple-java-versions – aled May 15 '23 at 11:38
  • Regrettably not - homebrew doesn't recognise that 19 and 20 are different versions – Duncan McGregor May 15 '23 at 11:40
  • 2
    Why not fix the underlying problem: why does the code you are trying to compile not compile with Java 20? Oracle is very careful with keeping Java backwards compatible, so if your code does not compile with 20 then there is likely something strange in your code. – Jesper May 15 '23 at 11:52
  • 2
    If you really cannot fix the real problem, then you can find 19 in the [archive](https://www.oracle.com/uk/java/technologies/downloads/archive/). – Jesper May 15 '23 at 11:53
  • 3
    OpenJDK 19 is already end of life. It was one of the short-lived versions. You are supposed to move on to the next version, or stay in one of the long term version like JDK 11 or 17. – aled May 15 '23 at 11:53
  • @aled except that I can't, because Gradle won't run under 20 yet. And yes, I can run Gradle with a different JVM, but OMFG it's a mess – Duncan McGregor May 15 '23 at 12:11
  • @Jesper It's a complete pain when a toolchain that was working fine stops working because of a random upgrade, especially when my code runs fine under 19, but Gradle doesn't. – Duncan McGregor May 15 '23 at 12:13
  • 4
    I appologize for the unnecessary snark, but your problem *is* a direct result of using a JDK which is explicitly not supported for a long time. It's unfortunate that the Gradle support windows don't align usefully with the Java support windows, but the fact that Java 19 is (and was always known to be!) supported only for a very short time makes problems like this much more likely when depending on it. What I'm trying to say: within my snark there was also a kernel of a suggestion to use this as a useful lesson: LTS versions exist for a reason. – Joachim Sauer May 15 '23 at 13:13
  • Thanks for the apology, and you have a point, but it feels that the window for upgrading from the current to the next version should be longer than 2 weeks! – Duncan McGregor May 15 '23 at 14:18
  • 2
    Agreed, that's why I treat the non-LTS releases as "playthings". It's annoying, but since the LTS releases are *roughly* as far apart as real releases were pre-Java-9, it means the cadence of "releases I can fully upgrade to" has stayed very consistent throughout the last decade. – Joachim Sauer May 15 '23 at 15:49
  • You can [upgrade your version of Gradle](https://docs.gradle.org/current/userguide/upgrading_version_7.html) – Basil Bourque May 15 '23 at 17:25
  • @BasilBourque is that enough? The docs say it doesn't support 20 https://docs.gradle.org/current/userguide/compatibility.html – Duncan McGregor May 16 '23 at 08:01

1 Answers1

0

https://jdk.java.net/ leads to https://jdk.java.net/19/ which has tar.gz downloads available.

Once the file is downloaded and expanded, the JVM it can be moved into the place that things seem to expect it with eg

sudo mv jdk-19.0.2.jdk /Library/Java/JavaVirtualMachines/

@Jesper points out a larger archive https://www.oracle.com/uk/java/technologies/downloads/archive/

There are script-friendly URLs and checksums available for many releases and architectures - https://www.oracle.com/java/technologies/jdk-script-friendly-urls/

Duncan McGregor
  • 17,665
  • 12
  • 64
  • 118