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);
Similar Posts:
- IDEA compile error: sun.misc.Base64decoder upgrade processing
- Sun.misc.base64decoder import exception and handling ideas
- Steps of MyEclipse / eclipse importing sun.misc.base64encoder jar package
- [Solved] Eclipse Error: Access restriction: The type ‘BASE64Decoder’ is not API
- The solution of base64decoder prompt error under eclipse
- [Solved] exception is java.lang.NoClassDefFoundError: com.sun.crypto.provider.SunJCE
- [Solved] Yaml Text Error: UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte : illegal multibyte sequence
- [Solved] Redisson Error: Caused by: java.lang.IllegalArgumentException: RIVER
- signer information does not match signer information of other classes in the same package
- [Solved] An attempt was made to call a method that does not exist. The attempt was made from the following location: