【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就可以编译通过。 

你可能感兴趣的:(Eclipse)