調用CachedRowSetImpl類時,出現以下錯誤:
Access restriction: The type CachedRowSetImpl is not accessible due to restriction on required library C:\glassfish3\jdk7\jre\lib\rt.jar
問題原因:
1.沒有rt.jar包,不過這種情況出現的可能性比較小
2.eclipse的設置問題(一般都是這個原因)
問題解決:
(1) 一般方法:要在project build path中先移除JRE System Library,再添加庫JRE System Library,之后就可以了。
(2) 暴力方法:它默認把這些受訪問限制的API設成了ERROR,我們只要把
Windows->Preferences->Java->Complicer->Errors/Warnings里面的Deprecated and restricted API中的Forbidden references(access rules)選為Warning就可以編譯通過了