调用com.sun.rowset包中的CachedRowSetImpl类时,出现以下错误: Access restriction: The
type ‘CachedRowSetImpl’ is not API (restriction on required library
‘C:\Program Files\Java\jdk1.8.0_191\jre\lib\rt.jar’)
中文翻译: 访问限制:类型’CachedRowSetImpl’不是API(对所需库’C:\ Program Files \ Java
jdk1.8.0_191 \ jre \ lib \ rt.jar’的限制)
但能在rt.jar中找到CachedRowSetImpl的类文件。这个是eclipse的设置问题,它默认把这些受访问限制的API设成了ERROR。
解决办法:(1)在Eclipse中设置按如下方法设置: Windows -> Preferences -> Java -> Compiler
-> Errors/Warnings -> Deprecated and restricted API -> Forbidden reference (access rules): -> change to warning
(2)然后需要先把JRE从构建路径(build path)移除然后再重新加入即可。
--本文来源于网络,非原创,只是用作笔记