問題如下:
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就可以編譯通過。