导入 sun.misc.BASE64Encoder 导致在 Eclipse 中编译出错
问题描述:
对于这两个导入;
import sun.misc.BASE64Encoder;
import sun.misc.BASE64Decoder;
我收到此错误:
Access restriction: The type BASE64Decoder is not accessible due to restriction on required library C:Program FilesJavajre6lib
t.jar
我该如何解决这个错误?
How can I resolve this error?
答
该错误是由您的 Eclipse 配置引起的.您可以将其减少为警告.更好,使用非 Base64 编码器非公共 API 的一部分.Apache Commons 有 一个,或者当您已经使用 Java 1.8 时,请使用 java.util.Base64
.
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
.