Failed when running java: Exception in thread "main" java.lang.NoClassDefFoundError: sun/misc/BASE64Encoder


I am trying to package android , but getting following error :

 Failed when running java: Exception in thread "main" java.lang.NoClassDefFoundError: sun/misc/BASE64Encoder
	at io.trigger.forge.ApkSigner.main(
Caused by: java.lang.ClassNotFoundException: sun.misc.BASE64Encoder
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(
	at java.base/java.lang.ClassLoader.loadClass(
	... 2 more 

I found few topic of discussion on this issues like : this or this . My current version of java 11.0.1 I guess which is causing the issue . One thread was saying for downgrade java version. But is there any cleaner way to resolve this issue ?


There is not. And removing 11 or 12 is a test of one’s patience.

I had to follow all the easily-found steps to remove what’s there.
Install 8.
Remove those steps AGAIN.
Reinstall 8.
Then reinstall the Trigger Toolkit.

Yes. No exaggeration. Finally, that’s what it took. On a Mac.

$*ck Java.


I have downgraded Java version .Now my java version is “1.8.0_211”. But still getting same issue.


This is of little or no help. I know this. But my observations trying to get my system fixed were these…

  1. removing 11 or 12 is really only just covering it up. I don’t think it ever really comes off.
  2. manually find every java executable on your machine, most notably find java and javac executables, and all the binaries in their directories. Verify you don’t have any 11 or 12 versions left hanging around, and if you do, either manually delete them and create your own simlinks back to ver 8, or at the very least, ensure where ever you find them is NOT in the path, or is referenced in any bash or other batch/command files.
  3. and I don’t mean to harp on this, reboot, reboot, reboot every step of the way on the uninstall and reinstall. Every step. It took me DAYS, morning to night, to get Forge working properly again after my Java upgrade. Like, drop everything and fix this because OMFG it’s an emergency at this point kind of stress level.

Antoine is going to have to address the Java level issue at some point. :frowning: