Skip to content

-Djava.lang.string.substring.nocopy

Restriction: This system property is supported only on Java™ 8 and Java 11. String sharing cannot be enabled on Java 17 and later.

Start of content that applies to Java 8 (LTS) Start of content that applies to Java 11 (LTS) Setting this property to true avoids sharing a String object when substring() is used to subset a String beginning from offset zero. Avoiding sharing is compatible with the Oracle HotSpot VM. End of content that applies to Java 8 and 11 (LTS)

Syntax

    -Djava.lang.string.substring.nocopy=[true|false]
Setting Effect Default
true No sharing
false Sharing yes