【Eclipse】Access restriction:

问题如下:

Access restriction: The type 'Resource' is not API (restriction on required library '/Library/Java/JavaVirtualMachines/

 jdk1.7.0_79.jdk/Contents/Home/jre/lib/rt.jar')



解决方法一: 
Project -> Properties -> libraries, 
先remove掉JRE System Library,然后再Add Library重新加入。问题解决 


解决方法二: 
Eclipse 默认把这些受访问限制的API设成了ERROR。 
只要把Windows-Preferences-Java-Complicer- Errors/Warnings里面的Deprecated and restricted API中的Forbidden references(access rules)选为Warning就可以编译通过。 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章