Solve problems in eclipse where Sun.misc.BASE64Encoder and Sun.misc.BASE64Decoder are not directly available

Source: Internet
Author: User
All along, the encryption and decryption of BASE64 algorithm is carried out by using the Base64encoder and Base64decoder under Sun.misc package. This class, however, is the sun's internal approach and is not publicly available in the Java API, but is not part of the JDK standard library category, but is included in the JDK and can be used directly. However, it is not found in Eclipse and MyEclipse, but it is used directly.
The problem is described in the following figure:

Solution: First Step: Right-click the build path on the project using the API under the SUN.MISC package, select Configure Build Path
Step two: In the Java Build Path window, click on the Third tab libraries, select JRE System libraries, select the first access rules, click Edit
Step three: Click Add in the pop-up window
Fourth Step: Select the accessible option after the resolution, the following rule pattern configuration for * *, click OK.
Fifth Step: Click OK
The sixth step: click Apply, click OK, you will see the workspace will be re-import build.
Let's look at the introduction of the Sun.misc package under the Base64encoder this class, the perfect solution.

The rest of the solution: You can also use the corresponding alternative API provided by a third party, Apache provides the Commons Codec, abbreviated as CC bouncy Castle bouncy Castle, abbreviation BC

Build.gradle joins third party dependencies:


After using Gradle refresh:



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.