How to add JDK 8 support in Eclipse?

In this JDK 8 tutorial series you will learn the process of installing and updating the Eclipse to support the JDK 8. In this tutorial we have use the Eclipse Luna (4.4) M6 and updated the JDK 8 support plugin.

How to add JDK 8 support in Eclipse?

In this JDK 8 tutorial series you will learn the process of installing and updating the Eclipse to support the JDK 8. In this tutorial we have use the Eclipse Luna (4.4) M6 and updated the JDK 8 support plugin.

How to add JDK 8 support in Eclipse?

Learn how to update Eclipse and add the JDK 8 support?

This tutorial explains you the process of adding JDK 8 support in Eclipse IDE with the help of video tutorial provided here. You will learn how to download and install the JDK 8 support plug-in from Eclipse updates website.

JDK 8 is recently released with many new features and its high time to start using the JDK 8 for developing your project. It is also necessary for developers to learn the new features of JDK 8. Since Eclipse is one of the most used IDE for developing the Java program, so probably you would like to use Eclipse for learning the new features of JDK 8. So, this tutorial is everyone who wants to learn the JDK.

We have created a video which shows you the process of installing the Eclipse plugin for adding the JDK 8 support to the Eclipse Luna. In the video tutorial you will learn how to install Eclipse Luna, install the JDK 8 support plugin and finally create Lambda expression example to test the JDK 8 support on the Eclipse.

Once JDK 8 support is added to the Eclipse you can start using for your JDK 8 project.

Here is the tutorial video which explains you "JDK 8 Support in Eclipse -- How to configure support JDK 8 in Eclipse IDE? ". You can find more video tutorials at Java at Java Programming video tutorial for beginners section.

Here is the steps to add JDK 8 support in Eclipse:

Step 1: Download JDK 8, install and configure on your computer.

Step 2: Download Eclipse Luna (4.4) M6 or above.

Step 3: Extract Eclipse Luna (4.4) M6 into your favorite directory.

Step 4: Run the eclipse.

Step 4: Then Help > Install New Software as shown below:

JDK 8 support in Eclipse

Then on the following screen click on the "" button as shown below:

JDK 8 support in Eclipse

Step 5: Enter the url of the plugin update website (http://download.eclipse.org/eclipse/updates/4.3-P-builds/)  as shown below:

JDK 8 support in Eclipse

and then click on the "OK" button. Installer will try to find the plugin as shown below:

JDK 8 support in Eclipse

Step 6: Check the checkboxes as shown below:

JDK 8 support in Eclipse

Now click on the "Next" button to start the installation.

Step 7: Accept the license agreement as shown below:

JDK 8 support in Eclipse

And then click on the "Finish" button. Installer will start installing the software as shown below:

JDK 8 support in Eclipse

Step 8: Once the installing is done installer will ask your for staring the Eclipse as shown below:

JDK 8 support in Eclipse

Step 9: Once Eclipse restarts make sure that the JDK 8 is selected for compilation and execution of the project. Go to the "Window"->"Preferences" as shown below:

JDK 8 support in Eclipse

0

Go to the Java -> Compiler tree and make sure that "Compiler Compliance level is" 1.8 and "Use default compliance setting" check box is checked as shown below:

JDK 8 support in Eclipse

Step 10: Now will create a new project and add a new package as shown below:

1

JDK 8 support in Eclipse

Step 11: Add the new class and add the code given below as shown in the following screen shot:

JDK 8 support in Eclipse

2

Here is the complete code of the program to test the Lambda expression:

package net.roseindia;

public class Hello {
	interface HelloService {
	      String hello(String firstname, String lastname);
	   }
	
	public static void main(String[] args) {
		HelloService helloService = (String firstname, String lastname) -> {
			String hello = "Hello " + firstname + " " + lastname;
			return hello;
		};
		System.out.println(helloService.hello("Deepak", "Kumar"));	
	}
}

Step 12: Now run the program and it will given desired output as shown below:

Eclipse-Java-8-installation-12.jpg

3

You can learn more about Java 8 by visiting our following Java 8 Tutorial section:

Check more tutorials of Java 8 (JDK 8).

After completing the above tutorial you should be able to install and configure JDK 8 support in Eclipse IDE.

4