[Solved] BASE64Encoder Error: Cannot resolve symbol ‘BASE64Encoder’

Question:

Cannot resolve symbol ‘BASE64Encoder’

reason:

After jdk9, the official does not support Import sun.misc.Base64encoder.

Solution:

Method 1: reduce the JDK version to less than 1.8. (not recommended)
Method 2: use the official new jar package import java.util Base64.

The purpose of the following Java class is to modify the corresponding coding format of the file name in different browsers to make it display Chinese correctly.

This is done with sun.misc.BASE64Encoder;

Set BASE64Encoder base64encoder = new BASE64Encoder(); Modify to Base64.Encoder encoder = Base64.getencoder();

And change the encode() method to encodeToString(). Nothing else needs to be modified.

In this way, IDEA will not report an error.

Read More: