import sun.misc.BASE64Encoder results in error compiled in Eclipse
That error is caused by your Eclipse configuration. You can reduce it to a warning. Better still, use a Base64 encoder that isn't part of a non-public API. Apache Commons has one, or when you're already on Java 1.8, then use
sun.misc.BASE64Decoder showing error in java application
Don't use classes in the sun.misc package. These are deprecated and terrible. Check out Apache commons codec for base64 encoding and decoding. Why not to use sun.misc.* classes
Andmore's Android Package Builder fails with error related to sun/misc/BASE64Encoder
eclipse.ini (in my Eclipse path), I found an explicit reference to JRE 11:
After I changed that to
I finally get an APK, and after cleaning the project once, I was able to install it on a device.
is the sun.misc package still available in java?
I suggest you forget about the
sun.misc.BASE64Encoder and use Apache Commons Base64 class. Here is the link: http://commons.apache.org/codec/apidocs/org/apache/commons/codec/binary/Base64.html
sun.misc.BASE64Encoder will cause a compilation error with Java 9 and it is already giving a warning in Java 8.
The right class to use is
I resolved the issue - details are found in this SO posting.
Why am I getting the error "NoClassDefFoundError: sun/misc/Unsafe" when trying to load sounds using the LWJGL library?
From your posted IDE screenshot I can see that you are using
- Java 12, and
- the Java Module System (
sun/misc/Unsafe is a (legacy) Java internal API which for that reason and by default is encapsulated (hidden) away when using the Java Module System.
In order for your application (and your used library) to access it, you need to explicitly include it in your
module-info.java by adding
Alternatively, you may also not use the Java Module System – in which case it should simply work. However, I recommend to continue using the module system.