How To Fix Java.Lang.NoClassDefFoundError: Javax/xml/bind/annotation/xmlschema When Install Android SDK

When i install android sdk use android skd manager, i meet an Java.Lang.NoClassDefFoundError error like below. The error message said that javax.xml.bind.annotation.XmlSchema class can not be found. I struggle for some time, and finally find the method to fix it.

$ ./sdkmanager
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
  at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(
  at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(
  at java.base/java.lang.ClassLoader.loadClass(
  ... 5 more

1. How To Fix javax.xml.bind.annotation.XmlSchema Class Can Not Be Found Error.

The reason for this error is because the jdk version that is used is not correct. So first you need to find out which java version are  you using.

  1. Open a terminal and run $ java -version command like below.
    $ java -version
    java version "12.0.1" 2019-04-16
    Java(TM) SE Runtime Environment (build 12.0.1+12)
    Java HotSpot(TM) 64-Bit Server VM (build 12.0.1+12, mixed mode, sharing)
  2. My java version is 12.0.1, this java version will cause this error, so i need to install another java version such as java 8 and then set java 8 as my default java jdk.You can read article How To Install / Uninstall Multiple Java Versions In Mac OS By Home Brew Or Manually to learn more.
  3. When you install java 8 successfully, run the command ./sdkmanager in terminal again, then the error will be disappeared.
READ :   Convert Excel To JSON In Java Example


  1. thanku so much…

    Java 8 has fixed my error for this


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.