Java EE/Jakarta EE Support for NetBeans 9
Java EE/Jakarta EE Support for NetBeans 9
Having trouble enabling Java EE and Jakarta EE support for you NetBeans 9 platform? Check out this tutorial to learn how to fix this on your app server.
Join the DZone community and get the full member experience.Join For Free
Secure your Java app or API service quickly and easily with Okta's user authentication and authorization libraries. Developer accounts are free forever. Try Okta Instead.
On July 30, NetBeans finally made the cut and got a major release under the Apache Foundation.
The most frequent question, since beta releases, is:
What about Java EE/C++/PHP?
First, the source code donation to Apache includes only the base NetBeans platform modules plus Java SE support. Please see the Apache Foundation official statement here.
Does This Mean That I Won't Be Able to Develop my Java EE Application on NetBeans 9?
Short answer: No
Long answer: Currently, Oracle already performed a second donation, where most of NetBeans modules considered as external are included. As the Apache statement suggests, these modules are expected on future NetBeans releases.
Is it Possible to Enable Java EE Support in NetBeans 9?
Considering that NetBeans has been modular since . . . ever, support for old modules in the new NetBeans version is possible. As a matter of fact, this is the official approach to enable Java EE support on NetBeans 9 — by using kits.
Hence, this tutorial is focused on enabling Java EE support on MacOS, but the steps should be exactly the same for Linux and Windows. To show some caveats, two app servers were tested with Java 8 and Java 10.
Downloading NetBeans 9.0
First, you should download the NetBeans package from official Apache Mirrors. At this time, distributions are only available as .zip files.
After the download, just uncompress the .zip file:
You should find a NetBeans executable at the
bin/ directory for Unix:
cd netbeans bin/netbeans
With this, you should be able to run NetBeans 9. By default, NetBeans will run on the most up-to-date JVM available at the system.
Enabling Java EE support
To install Java EE support, the NetBeans 8.2 update center repository should be added to the IDE.
First, go to
Tools > Plugins > Settings.
Second, add a new update repository:
Third, search for new plugins with the keyword "Kit." As the name suggests, these are plugin collections for specific purposes.
From experience, the following plugins are recommended for Java EE:
- HTML5 Kit
- SOAP Web Services
- EJB and EAR
- RESTful Web Services
- Java EE Base
Now, restart the IDE, and, then, you're ready to develop apps with Java EE.
Test 1: Wildfly 13
To test the NetBeans setup, I added a new application server and ran a recent Java EE 8 REST-CRUD application from a recent jEspañol presentation.
You have to select the WildFly Application Server
As WildFly release notes suggest, if you wanna Java EE 8 support, you should choose
standalone-ee8.xml as the domain configuration.
Domain configuration will be detected by NetBeans 9:
The WildFly team has been working on Java 9 and 10 compatibilities. Hence, the application ran as expected to deliver new records from an in-memory database.
Test 2: Glassfish 5 and Payara 5 on Java 10 (NetBeans) and Java 8 (App Server Platform)
To test the Vanilla experience, I tried to connect Payara and the Glassfish 5 app server. In the case of WildFly, the configuration is pretty straightforward:
You have to select the Payara Application Server:
The domain 1 default configuration should be fine:
Since Payara and Glassfish only support Java 8 (Java 11 support is on the roadmap), you have to create a new platform with Java 8. Go to
Tools -> Java Platforms and click on
Now, select a new Java SE Platform:
Pick the home directory for Java 8:
Finally, go to the server properties and change the Java platform:
At this time, it seems that NetBeans should be running on Java 8. Otherwise, you won't be able to retrieve the server's configuration and logs. There is a similar report on the Eclipse Plugin.
Test 3: Glassfish 5 and Payara 5 on Java 8 (NetBeans) and Java 8 (App Server Platform)
Finally, I configured NetBeans to use JDK 8 as NetBeans JDK. For this, you should edit the
etc/netbeans.conf file and point the
netbeans_jdkhome variable to JDK 8. Since I'm using jenv to manage JVM environments, the right value is:
With this, NetBeans 9 is able to run Payara 5 and Glassfish 5 as expected.
I'm still not sure about TomEE, OpenLiberty, WebSphere, and WebLogic, but it seems like it would be a matter of hacking a little bit on JDK versions.
Published at DZone with permission of Víctor Orozco . See the original article here.
Opinions expressed by DZone contributors are their own.