如何在Java 9中将jar添加到引导类路径

如何在Java 9中将jar添加到引导类路径

问题描述:

在运行于Java 8的应用程序中,我正在使用-bootclasspath:p将jar添加到引导类路径.在Java 9中,该选项已删除.在Java 9中执行相同操作的替代方法是什么?

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?

您可以使用-Xbootclasspath/a.请参阅发行说明,其中指出: -

You may use -Xbootclasspath/a. Please refer to the release notes which states:-

在此发行版中,引导类路径已被大部分删除. Java -Xbootclasspath-Xbootclasspath/p选项已被删除.

The boot class path has been mostly removed in this release. The java -Xbootclasspath and -Xbootclasspath/p options have been removed.

javac -bootclaspath选项仅在编译为JDK 8或 年纪大了.系统属性sun.boot.class.path已被删除.

The javac -bootclaspath option can only be used when compiling to JDK 8 or older. The system property sun.boot.class.path has been removed.

依赖于覆盖平台类进行测试的部署 -Xbootclasspath/p的用途将需要更改以使用 JEP 261 中记录的--patch-module选项.

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.

-Xbootclasspath/a选项保持不变.