Cannot disable CompactStrings Java 9 using Netbeans

287 Views Asked by At

I am trying to disable the CompactStrings feature of Java 9 using the VM option: -XX:-CompactStrings, but it does not work.

When I tried to debug my application, the COMPACT_STRINGS variable in String class is always true (with or without the VM option)

I have the latest version of Java 9: jdk-9+181 And the Netbeans IDE Build 201709070001

I tried various options to set the VM option and none of them works.

What I tried is: setting the VM option in app.conf, setting it in project.properties, running netbeans by ./netbeans -XX:-CompactStrings, setting the JVM option in Project->Properties->Run->VM Options

enter image description here

Is this a bug in Netbeans? Or am I doing something wrong?

1

There are 1 best solutions below

0
On

I tried to reproduce your problem using a trivial "Hello World" Java application. However, toggling the CompactStrings feature in the project properties settings worked fine for me, and caused COMPACT_STRINGS to be set appropriately, so this is not a bug in NetBeans.

Although I am using the same version of Java (181) as you, I have a more recent Dev Build of NetBeans (Build 201709220002), and there are several discrepancies between my project properties screen and yours. For example, mine shows the Runtime Platform field but yours does not:

Project Properties

Something else to check is that you really do have the environment you expect. I find it easy to mess things up when multiple versions of Java and Netbeans are installed.

This is what I see when I do Help -> About:

enter image description here

If your environment looks fine then I can only suggest that you download the latest DEV Build of NetBeans and try again.