Java background save Base64 image data
use byte [] bytes = new base64decoder(). Decodebuffer (STR); Sun.misc.base64decoder needs to be introduced, but it is prompted in eclipse that this war package does not exist
It is mentioned in an article after consulting:
All along, base64 encryption and decryption use base64encoder under sun.misc package and sun.misc.base64encoder/base64decoder class of base64decoder. This class is an internal method of Sun company and has not been disclosed in Java API. It does not belong to JDK standard library. However, it is included in JDK and can be used directly. But you can’t find this class if you use it directly in eclipse and MyEclipse. “
The solution is as shown in the figure: right click Project – properties – Java build path – JRE system library – access rules – resolution, select accessible, fill in * * below and click OK
In addition, there are corresponding alternative objects and methods on the Internet, such as using
Org. Apache. Commons. Codec. Binary. Base64, etc. You can check it yourself
change to org.apache.commons.codec.binary.base64 instead
String base64Code = request.getParameter("base64Code");
Base64 base64 = new Base64();
byte[] bytes = base64.decodeBase64(new String(base64Code).getBytes());
Personal test, the effect is the same
Similar Posts:
- IDEA compile error: sun.misc.Base64decoder upgrade processing
- IDEA sun.misc.BASE64Encoder
- 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
- Java – Convert bytes to unsigned bytes
- [Java. Lang. unsupported classversionerror] version inconsistency error
- [Solved] Typeerror: incorrect padding occurred in python3 Base64 decoding
- The jar file rt.jar has no source attachment appears in eclipse
- AES secret key length error: java.security.InvalidKeyException: Illegal key size or default parameters [Solved]