解决Eclipse Access restriction: 问题

By go - Last updated: 星期四, 四月 27, 2017

调试一个JAVA程序,Eclipse下报错:

The method encode(byte[]) from the type CharacterEncoder is not
accessible due to restriction on required library C:Program
FilesJavajdk1.6.0_21jrelibrt.jar

Access restriction: The method ‘AWTUtilities.setWindowShape(Window, Shape)’ is not API (restriction on required library

Access restriction: The type ‘AWTUtilities’ is not API (restriction on required library ‘C:Program FilesJavajre1.8.0_121librt.jar’)

其实要解决它也很容易,在Window -preferences – Java – Compiler –
Errors/Warnings界面的Deprecated and restricted API下。把Forbidden
reference (access rules): 的规则由默认的Error改为Warning即可。

发表在 工具软件 • • ↑Top 文章来源