[英]How do i get all the classes of sun.font in jdk9
I have my old codebase which currently uses java8 . 我有我的旧代码库,目前使用java8 。
I am migrating my codebase to use jdk9-ea . 我正在迁移我的代码库以使用jdk9-ea 。 But it looks like all the sun.font classes are now not available like the way they used to be earlier 但看起来所有的sun.font类都不像以前那样可用
error: package sun.font does not exist
More specifically i am using 更具体地说,我正在使用
and more.. 和更多..
A feature of the module system is that it allows library developers to strongly encapsulate implementation details due to the new accessibility rules . 模块系统的一个特性是它允许库开发人员强烈封装由于新的可访问性规则而导致的实现细节。 In a nutshell, most types in sun.*
and com.sun.*
packages will no longer be accessible. 简而言之, sun.*
和com.sun.*
包中的大多数类型将不再可访问。 This is in line with Sun and later Oracle stating that these packages are not meant for public consumption. 这与Sun和后来的Oracle一致,表明这些软件包不适合公共消费。
A workaround is to export these packages at compile and launch time with a command line flag: 解决方法是在编译和启动时使用命令行标志导出这些包:
--add-exports java.desktop/sun.font=ALL-UNNAMED
This exports the package sun.font
from the module java.desktop to all modules including the unnamed module , which is the one that collects all classes on the class path. 这sun.font
软件包sun.font
从模块java.desktop导出到所有模块,包括未命名的模块 ,该模块收集类路径上的所有类。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.