Fix Netbeans error adding Java ME platform with newer JDK

Whenever you try to add the Java ME SDK 3.4 into Netbeans 7.4 when using a Java SDK 8u120 or newer, this will fail due to an error introduced by the new implementation of serialization filtering.

Apache NetBeans IDE logo

Symptoms

You try to add Java ME SDK 3.x into Netbeans platforms when using JDK 8u120 or newer with the Tools > Java Platforms > Add Platform > Java ME CLDC Platform Emulator option and get the following error:

Add Java Platform

Automatic detection of the selected platform failed.

This error is caused by the new implementation of serialization filtering from JDK 8u120.

Solution

In this case we’ll be using JDK 8u171.

Open your C:\Program Files\Java\jdk1.8.0_171\jre\lib\security\java.security file and add these settings at the bottom of the file:

jdk.serialFilter=*
sun.rmi.registry.registryFilter=*
sun.rmi.transport.dgcFilter=\
java.rmi.server.ObjID;\
java.rmi.server.UID;\
java.rmi.dgc.VMID;\
java.rmi.dgc.Lease;\
maxdepth=10;maxarray=10000

Save the file and re-add it to Netbeans from the Tools > Java Platforms > Add Platform menu.

Alternative solution

Since this problem was introduced in JDK 8u120, you can use up to version 8u112 to avoid this error without any manual workarounds.

Add Java Me Platform Netbeans

Add Java Me Platform Netbeans Fix

Adding Java ME SDK 3.4 Netbeans plugins

After adding the Java ME platform, don’t forget to install the plugins from the downloaded oracle-jmesdk-3-4-rr-nb-plugins.zip file using the Netbeans Plugins dialog.

To do so, first extract the contents of the plugins ZIP file in any location, such as the folder where the Java ME SDK was installed. Then, in the Plugins > Settings dialog, add a new Update Center that points to the location of your unzipped updates.xml file, as follows:

Java ME SDK Update Center

Once you have added your custom update center, switch to the Available Plugins and click Check for Newest. This will show only 2 plugins:

  • Java ME SDK Tools
  • Java ME SDK Demos

Selecting these plugins will cause Netbeans to install the complete list of unzipped plugins, since they are dependent on them. Notice that you won’t be able to easily install these plugins in Netbeans 8.2 due to a Java Profiler Core incompatibility, you should install them on Netbeans 7.4 only.

Java ME SDSK Plugins

Once installed, Netbeans will startup with a secondary welcome dialog called Java ME SDK Start Page, as shown below.

Netbeans Java ME SDK Start Page

Netbeans Java ME SDK Start Page

Disclaimer

The content in this post is for general information purposes only. The information is provided by the author and/or external sources and while we endeavour to keep the information up to date and correct, we make no representations or warranties of any kind, express or implied, about the completeness, accuracy, reliability, suitability or availability with respect to the website or the information, products, services, or related graphics contained on the post for any purpose. Some of the content and images used in this post may be copyrighted by their respective owners. The use of such materials is intended to be for educational and informational purposes only, and is not intended to infringe on the copyrights of any individuals or entities. If you believe that any content or images used here violate your copyright, please contact us and we will take appropriate measures to remove or attribute the material in question.