Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

import sun.misc.BASE64Encoder results in error compiled in Eclipse

Tags:

java

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 C:\Program Files\Java\jre6\lib\rt.jar 

How can I resolve this error?

like image 429
karikari Avatar asked Apr 05 '11 08:04

karikari


2 Answers

Go to 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.)

like image 96
Nikunj Avatar answered Sep 20 '22 23:09

Nikunj


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, or when you're already on Java 1.8, then use java.util.Base64.

like image 26
user207421 Avatar answered Sep 17 '22 23:09

user207421