Access restriction: The method 'CharacterEncoder.encode(byte[])' is not API 问题解决

https://blog.****.net/ustcxjt/article/details/7438614


Access restriction: The method encode(byte[]) from the type CharacterEncoder is not accessible due to restriction on required library C:\Program Files\Java\jre1.6.0_02\lib\rt.jar

 

调用BASE64Encoder和BASE64Decoder时出现错误

 

解决方法如下

 

eclipse下Window-->Preferences-->Java-->Compiler-->Error/Warnings.
Select Deprecated and Restricted API. Change it to warning.
Change forbidden and Discouraged Reference and change it to warning. (or as your need.)

如下图所示

Access restriction: The method 'CharacterEncoder.encode(byte[])' is not API 问题解决

 

 

 

ok

 

 

 

 

调用BASE64Encoder和BASE64Decoder时出现错误

 

解决方法如下

 

eclipse下Window-->Preferences-->Java-->Compiler-->Error/Warnings.
Select Deprecated and Restricted API. Change it to warning.
Change forbidden and Discouraged Reference and change it to warning. (or as your need.)

如下图所示

Access restriction: The method 'CharacterEncoder.encode(byte[])' is not API 问题解决

 

 

 

ok