The openjdk document "JEP 261: Module System" states that:
"A related option, -Xbootclasspath/a
, allows files and directories to be appended to the default bootstrap class path. This option, and the related API in the java.lang.instrument
package, is sometimes used by instrumentation agents, so for compatibility it is still supported at run time.
Its value, if specified, is reported via the JDK-specific system property jdk.boot.class.path.append
."
However, when I try to use this feature, it does not work. Specifically, I am using Java Agents to do instrumentation.
All works fine on JDK7 & JDK8. On JDK9+ the -Xbootclasspath/a
seems to work ok, but the system property jdk.boot.class.path.append
is always null
.
On java 7/8:
String bootclasspath = System.getProperty(`sun.boot.class.path`);
works as expected.
On java 9:
String bootclasspath = System.getProperty("jdk.boot.class.path.append");
always return null string.
I added some debug code to dump all the system properties, and there appears to be no such property.
I have tried jdk-9.0.4
and jdk-11.0.3
with similar results.
Any ideas on how to get the bootclasspath on JDK9+?