This morning I noticed that Clojure 1.10.0-RC1 was out, and that it was setting a minimum of JDK 1.8 as the required Java version. That's not a problem, as that's what I've been using, but I thought it might be a good thing to get the lates versions of the JDK installed on my box, and make sure that JDK 10 and JDK 11 work with the setjdk Bash function I wrote to make it easy to change from version to version in the environment.
So I went to the java.com web site, and first noticed that the current version they are suggesting is JDK 1.8 - and that really surprised me. I have known that JDK 9, 10, and 11 have been out for a bit, but to see that Oracle is suggesting that a new user install JDK 1.8.0_181 - that's just a little surprising.
Also, they made it a lot harder to find the other versions of the JDK - maybe that's because there was more confusion than necessary for folks just looking for the latest JDK - but therein is kinda my concerned - JDK 1.8. Still... I found it and was able to get the latest JDK 1.8.0_181, JDK 10.0.2, and JDK 11 - they have clearly decided to change the versioning, which is OK with me - but it means that I really need to make sure that I check the setjdk function when I install these guys.
When I got them installed, they all looked in place:
peabody{drbob}516: ls -lsa /Library/Java/JavaVirtualMachines/
total 0
0 drwxr-xr-x 13 root wheel 416 Oct 11 10:29 ./
0 drwxr-xr-x 5 root wheel 160 Sep 24 19:00 ../
0 drwxr-xr-x 3 root wheel 96 Jun 29 2011 1.6.0_26-b03-383.jdk/
0 drwxr-xr-x 3 root wheel 96 Oct 11 10:29 jdk-10.0.2.jdk/
0 drwxr-xr-x 3 root wheel 96 Oct 11 10:29 jdk-11.jdk/
0 drwxr-xr-x 3 root wheel 96 Feb 5 2013 jdk1.7.0_13.jdk/
0 drwxr-xr-x 3 root wheel 96 Oct 16 2013 jdk1.7.0_45.jdk/
0 drwxr-xr-x 3 root wheel 96 Jan 17 2014 jdk1.7.0_51.jdk/
0 drwxr-xr-x 3 root wheel 96 Mar 20 2015 jdk1.7.0_75.jdk/
0 drwxr-xr-x 3 root wheel 96 May 1 2017 jdk1.8.0_131.jdk/
0 drwxr-xr-x 3 root wheel 96 Oct 2 2017 jdk1.8.0_144.jdk/
0 drwxr-xr-x 3 root wheel 96 Oct 11 10:28 jdk1.8.0_181.jdk/
0 drwxr-xr-x 3 root wheel 96 Mar 20 2015 jdk1.8.0_40.jdk/
and then a quick check of the setjdk script:
peabody{drbob}504: setjdk 10
peabody{drbob}505: echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk-10.0.2.jdk/Contents/Home
peabody{drbob}506: setjdk 11
peabody{drbob}507: echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk-11.jdk/Contents/Home
peabody{drbob}508: setjdk 1.8
peabody{drbob}509: echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home
This is the current cut of my setjdk function in my ~/.bashrc file:
#
# Clever trick to leverage the /usr/bin/java commands to take advantage
# of the JAVA_HOME environment variable and the /usr/libexec/java_home
# executable to change the JDK on-the-fly. This is so easy I'm amazed.
#
function removeFromPath() {
export PATH=$(echo $PATH | sed -E -e "s;:$1;;" -e "s;$1:?;;")
}
function setjdk() {
if [ $# -ne 0 ]; then
removeFromPath '/System/Library/Frameworks/JavaVM.framework/Home/bin'
if [ -n "${JAVA_HOME+x}" ]; then
removeFromPath $JAVA_HOME
fi
export JAVA_HOME=`/usr/libexec/java_home -v $@`
fi
}
setjdk 1.8
So now I can work with any version of Java out there. What I did find interesting is that they have pulled JDK 9 - and that means it was really bad. Like Wow bad... at least they knew to pull it.