I have my old codebase which currently uses java8 .
I am migrating my codebase to use jdk9-ea . But it looks like all the sun.font classes are now not available like the way they used to be earlier
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. This is in line with Sun and later Oracle stating that these packages are not meant for public consumption.
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.