开发者

Use sun.* classes in Eclipse Java project

开发者 https://www.devze.com 2023-01-22 23:41 出处:网络
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:

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?


In Window -> Preferences -> Java -> Compiler -> Errors/Warnings, find the "Deprecated and restricted API section", and change the "Forbidden reference" setting from Error to Warning or Ignore.

0

精彩评论

暂无评论...
验证码 换一张
取 消