【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就可以編譯通過。 

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