At the time of this writing, Java 9 is in beta. I installed because I wanted to check out jshell, Java’s new REPL (read-evaluate-print-loop). On top of the below, I brew-installed jenv (a must for managing different JDK versions).
$ brew install Caskroom/versions/java9-beta $ jenv add /Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home $ jenv shell oracle64-9-ea $ java -version java version "9-ea" Java(TM) SE Runtime Environment (build 9-ea+102-2016-01-21-003129.javare.4316.nc) Java HotSpot(TM) 64-Bit Server VM (build 9-ea+102-2016-01-21-003129.javare.4316.nc, mixed mode) $ jshell | Welcome to JShell -- Version 9-ea | Type /help for help -> "Hello JDK 9!" | Expression value is: "Hello JDK 9!" | assigned to temporary variable $1 of type String
I also did the following to get jshell to work:
1. Added to ~/.bash_profile
eval "$(jenv init -)"
2. Added my hostname in /etc/hosts
Cheers, and enjoy learning lambdas!