简体   繁体   中英

Use sun.* classes in Eclipse Java project

I was sent some Java code that uses classes in the sun.awt.shell package, which is not part of the JDK public API, so Eclipse will not compile the project:

Access restriction: The method getIcon(boolean) from the type ShellFolder is not accessible due to restriction on required library /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/classes.jar

While I agree with the sentiment, can I coerce Eclipse to compile it anyway?

Window -> Preferences -> Java -> Compiler -> Errors/Warnings ,找到“Deprecated and restricted API section”,并将“Forbidden reference”设置从Error更改为Warning或Ignore。

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM