在项目中使用BASE64Decoder,eclipse的编辑器莫名报错,
Multiple markers at this line
- Access restriction: The type BASE64Decoder is not accessible due to restriction on
required library C:\Program Files\Java\jre6\lib\rt.jar
- Access restriction: The method decodeBuffer(String) from the type CharacterDecoder is
not accessible due to restriction on required library C:\Program Files\Java\jre6\lib\rt.jar
- Access restriction: The constructor BASE64Decoder() is not accessible due to
restriction on required library C:\Program Files\Java\jre6\lib\rt.jar
可见eclipse对rt.jar中的sun.*没有权限可以访问,在项目上右键点击Properties-Java Build Path,选择右侧的Libraries标签,展开JRE System Library,选中Access rules,点击Edit,Add一条rule,其中Resolution选择Accessible,Rule Pattern填入sun/**,保存后错误即消失。