Tag Archives: IDEA sun.misc.BASE64Encoder

IDEA sun.misc.BASE64Encoder

Method 1: one of the solutions is to change JDK from 12 to 8

Since Java 8, we have replaced sun.misc.base64encoder with java.util.base64 tool class

Or:

Method 2

mport sun.misc.BASE64Encoder;

import sun.misc.BASE64Decoder;

In the project, design to 64 bit encoding. Sometimes development will use the base64 tool in JDK. But Sun suggests not to do so. Especially after the JDK version is updated, the project even has saved information. You can refer to import org.apache.commons.codec.binary.base64; Replace

One solution:

In the original jar package of JDK

return new BASE64Encoder().encode(encrypted);
replace with

import org.apache.commons.codec.binary.Base64;
return Base64.encodeBase64String(encrypted);
will

byte[] encrypted1 = new BASE64Decoder().decodeBuffer(text);
replace with

import org.apache.commons.codec.binary.Base64;
byte[] encrypted1 =Base64.decodeBase64(text);