Search This Blog

Wednesday, August 28, 2013

import sun.misc.BASE64Encoder got error in Eclipse

Problem:
while importing sun.misc.BASE64Encoder got error in Eclipse; For this two imports;
import sun.misc.BASE64Encoder;
import sun.misc.BASE64Decoder;

I got this error:
Access restriction: The type BASE64Decoder is not accessible due to restriction on required library xxx.jar

Cause:
That error is caused by your Eclipse configuration. You can reduce it to a warning. Better still, use a Base64 encoder that isn't part of a non-public API. Apache Commons has one.

Solution:
  1. Go to Window-->Preferences-->Java-->Compiler-->Error/Warnings.
  2. Select Deprecated and Restricted API. Change it to warning.
  3. Change forbidden and Discouraged Reference and change it to warning. (or as your need.)

No comments: