Recently, in the project, I encountered the problem of inconsistency between the development environment jdk and the compilation environment jdk and the online jdk [version 12]. Cause the error sun.misc.BASE64Encoder cannot find the jar problem
In the project, design to 64-bit encoding. Sometimes development will use the BASE64 tool that comes with the JDK. However, Sun recommends not to do so. Especially since the JDK version is updated, the project even has saved information.
sun.misc.BASE64Encoder is not recommended to use the contents of the java.sun package
import sun.misc.BASE64Encoder;
import sun.misc.BASE64Decoder;
Can refer to import org.apache.commons.codec.binary.Base64; replace
The original JDK that comes with the jar package
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);