Access restriction: The type 'BASE64Encoder' is not API 的解决方法
轉自:?https://www.mkyong.com/java/access-restriction-the-type-base64encoder-is-not-accessible-due-to-restriction/
If you insist want to use?sun.misc.BASE64Encoder, in Eclipse, right click on the project, properties -> Java compiler –> Errors/Warnings –> 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?Apache common codec. that is?http://commons.apache.org/proper/commons-codec/?
import org.apache.commons.codec.binary.Base64;//...result = new Base64().encodeToString(rawHmac); 創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎總結
以上是生活随笔為你收集整理的Access restriction: The type 'BASE64Encoder' is not API 的解决方法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 消息称泰坦号潜艇遇难事件将改编为电影
- 下一篇: 调用toString()方法的注意事项