Set Up Eclipse, IntelliJ And NetBeans For Java 9

This tutorial is going to cover how to set up Eclipse, IntelliJ and NetBeans for Java 9 which has been released.

1. Prerequisites

Java 9 is installed in your environment. You can download it from the official website or follow instructions from below tutorials to install it.

2. Set Up Eclipse For Java 9

2.1. Prerequisites

The Eclipse Java™ 9 Support contains the following:

  • Ability to add JRE and JDK 9 as installed JRE.
  • Support for JavaSE-9 execution environment.
  • Ability to create Java and Plug-in projects that use a JRE or JDK 9.
  • Ability to compile modules that are part of a Java project.

2.2. Download and Install Eclipse

You can obtain an appropriate version of Eclipse Oxygen at the Eclipse download page and get it installed by simply extracting the compressed file.

Notice that if you install Java 9 and use it to run Eclipse, then you may get the following error when you start Eclipse:

Set up Eclipse for Java 9 - javaw not found

javaw.ext not found

To fix this error, you will need to specify the use of your Java 9 VM by adding the following lines after the –launcher.appendVmargs line to the eclipse.ini file.

In addition, we will need to add the following vmargs to eclipse.ini:

 

So, the eclipse.ini should contain the following lines:

2.3. Install Java 9 Support for Oxygen for Eclipse

As mentioned in above link, to install the Eclipse Java™ 9 Support, there are two possible ways:

  • Drag and drop the below install button onto your running Eclipse.

Drag to your running Eclipse* workspace. *Requires Eclipse Marketplace Client

  •  Or update your Eclipse 4.7 build using this update site: http://download.eclipse.org/eclipse/updates/4.7-U-builds. In Eclipse, go to Help > Install New Software… and uncheck “Group items by category”. Select “Eclipse SDK” from the list of items and proceed with the installation.
Set up Eclipse for Java 9 - Java 9 Support for Oxygen

Install Java 9 Support for Oxygen

When you’re done, you need to restart the Eclipse. Open Window –> Preferences –> Installed JREs, we will see the Java 9 is selected as below example:

 

Set up Eclipse for Java 9 - JRE 9 is set default

JRE 9 is set to default

That is the final step to set up Eclipse for Java 9 development and you can get started with Java 9 new features by the following tutorial Java 9 Example With Maven And JUnit 5.

3. Set Up IntelliJ IDEA For Java 9

Currently, the Java 9 is supported from the IntelliJ IDEA 2017.3 EAP (Early Access Program) and you can download it from JetBrains website. After that, you can click on the downloaded file to install the IDE as a normal software.

Once you’re done to set up IntelliJ IDEA for Java 9, you can get started with new features of Java 9 from Java 9 Example With Maven And JUnit 5. The source code and sample project is a Maven based project, so it’s easy to be imported in IntelliJ.

Now, let’s see some examples of Java 9 source code in IntelliJ IDEA:

Set Up IntelliJ IDEA For Java 9 - Sample Java 9 Code

Sample Java 9 source code in IntelliJ IDEA

Next will be a view of JShell Console supported in IntelliJ IDEA:

Set Up IntelliJ IDEA For Java 9 - JShell Console

Java 9 JShell Console in IntelliJ IDEA

To learn more about Java 9 and IntelliJ IDEA, please visit its website.

4. Set Up NetBeans IDE For Java 9

Currently, in similar to other IDEs such as Eclipse and IntelliJ IDA,  NetBeans IDE Daily Development builds contains also early (under development) support for JDK 9 namely the new modular system for Java. To download the daily development builds, you can visit http://bits.netbeans.org/download/trunk/nightly/latest/start.html.

After downloading, you can go ahead to install it. And once you’re done to set up NetBeans IDE for Java 9, you can get started to explore new features of Java 9 on NetBeans from my sample project on Github.

Next, let’s see some examples of Java 9 source code in NetBeans IDE:

Set up NetBeans IDE for Java 9 - Java 9 Sample

Java 9 same source in NetBeans

And here is another image about graph view of the module-info.java file in NetBeans:

Set up NetBeans IDE for Java 9 - module-info.java in NetBeans

Graph view of module-info.java in NetBeans

To learn more about JDK9 support in NetBeans, please visit its website.

5. Maven Supported For Java 9

Maven also supported to build Java 9 project; to configure it, please visit Java 9 Example With Maven And JUnit 5.

6. Conclusions

The tutorial has illustrated how to set up Eclipse, IntelliJ and NetBeans for Java 9. We can see that Java 9 has been released; there still be very early for IDEs can fully support it. However, we can try new features of Java 9 with Early Access Programs or Nightly Builds of their IDEs.

Below are other Java 9 related tutorials for your references:

Create Immutable Lists In Java 9 By Static Factory Methods

Java 9 Example With Maven And JUnit 5

Using The InputStream.transferTo() To Copy Streams In Java 9