How to install a legacy JDK 1.6 on Mojave with SDKMAN

Posted by Brian Porter on December 09, 2018

It took awhile to figure this out, so I thought I would share it. First you have to have SDKMAN installed (https://sdkman.io). Then you have to download the legacy JDK 1.6 from Apple here https://support.apple.com/kb/dl1572?locale=en_US

Once that is installed, you have to link the Apple JDK with a symbolic link in the SDKMAN canidates directory, and install it.

$ cd ~/.sdkman/candidates/java
$ ln -s /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/ 1.6.0.jdk
$ sdk use java 1.6.0.jdk
$ java -version
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-468)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-468, mixed mode)