问题
In my application that runs on java 8, I am using -bootclasspath:p
to add a jar to the boot classpath. In java 9, the option is removed. What is the alternative to do the same in java 9?
回答1:
You may use -Xbootclasspath/a
. Please refer to the release notes which states:-
The boot class path has been mostly removed in this release. The java
-Xbootclasspath
and-Xbootclasspath/p
options have been removed.The
javac -bootclaspath
option can only be used when compiling to JDK 8 or older. The system propertysun.boot.class.path
has been removed.Deployments that rely on overriding platform classes for testing purposes with
-Xbootclasspath/p
will need to changed to use the--patch-module
option that is documented in JEP 261.The
-Xbootclasspath/a
option is unchanged.
来源:https://stackoverflow.com/questions/48148607/how-to-add-a-jar-to-the-boot-classpath-in-java-9