如果在Eclipse使用某些访问受限的API时,会报这种错误:
Access restriction: The type Resource is not accessible due to restriction on required library
这是因为Eclipse默认把这些受访问限制的API设成了ERROR,在java-compiler-Errors/Warnings选项里面的Deprecated and restricted API中的Forbidden references(access rules)选为Warning就可以编译通过,只是报警告而不是报错,保证了编译能通过。
Eclipse编译包
02-15
117
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
07-15
255
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
04-14
1万+
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交