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
- You need Oxygen (4.7 or above) Eclipse SDK.
- Install Java 9 Support for Oxygen for Eclipse from Eclipse Marketplace.
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:
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.
1 2 |
-vm C:\Program Files\Java\jdk-9\bin\javaw.exe |
In addition, we will need to add the following vmargs to eclipse.ini:
1 |
--add-modules=ALL-SYSTEM |
So, the eclipse.ini should contain the following lines:
1 2 3 4 5 6 |
--launcher.appendVmargs -vm C:\Program Files\Java\jdk-9\bin\javaw.exe -vmargs -Dosgi.requiredJavaVersion=1.8 --add-modules=ALL-SYSTEM |
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.
- 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.
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:
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:
Next will be a view of JShell Console supported 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:
And here is another image about graph view of the module-info.java file 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
Java 9 HTTP 2 Client API Example
This is a really great post about setting up all the IDEs with Java 9, thanks!
Just one point to clarify – IntelliJ IDEA has had full support for Java 9 since IntelliJ IDEA 2017.1, which came out at the start of this year. The current stable production build (2017.2) has most of the Java 9 features covered in :this post. The only feature that needs the 2017.3 EAP is the integrated JShell console.
Thanks, I’ll have look at it.
this article I marked several days ago saves me for the failed launch of Eclipse.I was so frustrated before as a Java beginner.thank you.