Update to JDK 8 on Mac OS

Java 8 (1.8.11 at the time of the writing) is the latest Java version. It was released in March this year and contain various major updates, including the long-waited lambda support. This blog described how to update to JDK 8 on Mac OS and also to check the lambda support with a simple app.
First check your current java version
Open a terminal and type

java -version

Then go to Oracle’s Java download page and find the latest Java 8 JDK (java8u11) at the point of this article

Then test compiling and running this app. The app should print “Test Lambda” to the screen.

javac TestJava8.java
java TestJava8
Test Lambda

If you are using Eclipse, update Eclipse to use JDK 8 as followed:

Go to Eclipse->Preference to open the preference window,

Then type “jre” at the left panel’s search field to find “Installed JREs”. Click on “Installed JREs”, then click the “Add” button to add JDK.

Select “Standard VM” and click Next.

Then click on the “Directory” button and browse to “/Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home”, click “Open” button to select. Change JRE name to “JDK 1.8.0_11”. Then click Finish to finish adding JDK 8