Access restriction: The type 'BASE64Decoder' is not API (restriction on required library xxx)

有人可能遇到的是一个错误,

也可能是一个提示!

在类中使用了

import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;

就会遇到这个问题。

问题原因:

参考:https://stackoverflow.com/questions/44268690/access-restriction-the-type-base64decoder-is-not-api

所有sun。*和com.sun。*软件包对Java实现都是私有的。任何未来的Java版本都可能会改变它们,可能会破坏依赖它们的应用程序代码。相比之下,java。*,javax。*和javafx。*软件包中的所有类都被设置为一成不变。他们的名字和公众成员不会改变,也不会被删除(理论上,已弃用的除外)。这就是为什么你会得到一个消息,说明这些类不是公共API的一部分。它们不适合公共消费。从Java 8开始,您应该使用java.util.Base64。但是,它看起来像使用Java 7,因此您需要使用DatatypeConverter.parseBase64Binary和DatatypeConverter.printBase64Binary。还应该提到的是,预计将于2017年7月发布的Java 9将不允许程序访问sun。*课程。请参阅https://mreinhold.org/blog/jigsaw-module-system。

解决方法:

改用 java.util.Base64,例如:

String hash = new String(Base64.getEncoder().encode(raw));
return new String(Base64.getEncoder().encode(rawString.getBytes(charsetName)));
return new String(Base64.getDecoder().decode(encrypted.getBytes(charsetName)));

Access restriction: The type 'BASE64Decoder' is not API (restriction on required library xxx)相关推荐

  1. eclipse报Access restriction: The type 'BASE64Decoder' is not API处理方法

    今天从svn更新代码之后,由于代码中使用了BASE64Encoder    更新之后报如下错误:  Access restriction: The type 'BASE64Decoder' is no ...

  2. SVN检出项目报:Access restriction: The type 'BASE64Decoder' is not API

    1.起因 今天从SVN里检出项目出现个别文件报错(Access restriction: The type 'BASE64Decoder' is not API (restriction on req ...

  3. Access restriction: The type 'BASE64Encoder' is not API 的解决方法

    转自: https://www.mkyong.com/java/access-restriction-the-type-base64encoder-is-not-accessible-due-to-r ...

  4. 【JavaWeb】Access restriction The type is not accessible due to restriction on required library

    MyEclipse无法访问到jar包的解决方法 MyEclipse中编写Java代码时,用到了BASE64Decoder import sun.misc.BASE64Decoder: 和图片处理相关的 ...

  5. java常见错误--Access restriction: The type BASE64Encoder

    Access restriction: The type BASE64Encoder is not accessible due to restrict 在Eclipse中编写Java代码时,用到了B ...

  6. Access restriction: The type Unsafe is not accessible due to restriction on required library

    无事下载Google的common包guarva玩玩,丢到eclipse中就编译报错:Access restriction: The type Unsafe is not accessible due ...

  7. Access restriction: The type BASE64Encoder is not accessible due to restrict

    在eclipse中使用sun.misc.BASE64Encoder,却提示"Access restriction: The type BASE64Encoder is not accessi ...

  8. The constructor BASE64Decoder() is not accessible due to restriction on required library

    搭建G4Studio的开发环境出现这个错误: Description Resource Path Location Type Access restriction: The constructor B ...

  9. Access restriction required library rt.jar

    在JAVA项目开发中,使用到了BASE64Decoder,但编辑运行时却会出现以下错误:Access restriction required library rt.jar,这里就详细的说明一下如何解 ...

  10. [C++]出错member access into incomplete type

    文章转自:https://blog.csdn.net/wcjwdq/article/details/43604679 版权归原作者. 在c++中,有四个文件demoA.h, demoA.cpp, de ...

最新文章

  1. Delphi 的内存操作函数(2): 给数组指针分配内存
  2. Flash与组件:国外收费组件网站
  3. mysql group by怎么用
  4. opencv摄像头 vmware虚拟机出现select timeout
  5. [转]敏捷开发中编写高质量Java代码
  6. 微软开源Scalar,提升操作巨型Git仓库的速度
  7. spring-data-JPA使用JpaRepository注解自定义SQL查询数据库多表查询
  8. 2017-06-27
  9. 软件测试基础——理论知识
  10. Java私塾中级note
  11. linux 统计文件字节和行数,Linux命令-统计文件中的字节数、字数、行数:wc
  12. 支付宝服务商ISV 签约开放能力
  13. 解决iOS 12.4 (16G77), which may not be supported by this version of Xcode
  14. matlab 椭圆积分函数,第一类完全椭圆积分
  15. ice的意思_ice是什么意思_ice的翻译_音标_读音_用法_例句_爱词霸在线词典
  16. CCCF“CNCC2017特邀报告”丘成桐:现代几何学与计算机科学
  17. php interface类,类相关的关键字 - interface
  18. 深入了解机器学习 (Descending into ML):训练与损失
  19. cad偏移后自动变色lisp_高手帮忙修改,批量偏移 - AutoLISP/Visual LISP 编程技术 - CAD论坛 - 明经CAD社区 - Powered by Discuz!...
  20. 在windows上部署IIS web服务

热门文章

  1. RxJava结合Retrofit使用 自定义封装类结合泛型 请求网络数据+Fresco+RecyclerView+MVP分层
  2. python定位地理位置_python 实现ip定位地址
  3. 手机端APP接口拦截(抓包)-Charles
  4. Telink BLE SIG Mesh GATT 配网功能
  5. Mac操作系统输入法快捷键设置
  6. 微信群解答_各月各旬降水量均值_巧用groupby
  7. Excel宏的介绍及应用
  8. html 415错误,HTTP 415 错误 – 不支持的媒体类型(Unsupported media type)
  9. 【Excel文件合并工具】
  10. 改变电阻的c语言程序,c语言电阻器分类代码实现