Thursday, July 4, 2013

Access restriction: The type BASE64Decoder is not accessible due to restriction on required library C:\Program Files\Java\jdk1.6.0_25\jre\lib\rt.jar

Error :

You may get below compile error in eclipse while using BASE64Decoder or BASE64Encoder.

Access restriction: The type BASE64Decoder is not accessible due to restriction on required library C:\Program Files\Java\jdk1.6.0_25\jre\lib\rt.jar

Using sun.* package should be avoided, Please see the link.

Solution :

Still if you need to access sun.misc.BASE64Encoder, in Eclipse, right click on the project, properties -> Java compiler –> Errors/Warnings –> Enable project specific settings -> Deprecated and restricted API –> Forbidden reference (access rules), change the default "Error" to "Warning". Now, your code should be able to compile, but with some warning messages.



The above solution is not recommended, you should replace sun.misc.BASE64Encoder with other BASE64 class like org.apache.commons.codec.binary.Base64; Apache common codec

No comments:

Post a Comment