如果在Eclipse使用某些访问受限的API时,会报这种错误:
[color=red][b]Access restriction: The type Resource is not accessible due to restriction on required library[/b][/color]
这是因为Eclipse默认把这些受访问限制的API设成了ERROR,在java-compiler-Errors/Warnings选项里面的Deprecated and restricted API中的Forbidden references(access rules)选为Warning就可以编译通过,只是报警告而不是报错,保证了编译能通过。
[color=red][b]Access restriction: The type Resource is not accessible due to restriction on required library[/b][/color]
这是因为Eclipse默认把这些受访问限制的API设成了ERROR,在java-compiler-Errors/Warnings选项里面的Deprecated and restricted API中的Forbidden references(access rules)选为Warning就可以编译通过,只是报警告而不是报错,保证了编译能通过。
本文介绍了解决Eclipse中使用受限API时出现的访问限制错误的方法。通过调整编译器设置,将受限API的错误级别从ERROR改为WARNING,从而确保项目能够成功编译。
1万+

被折叠的 条评论
为什么被折叠?



