Run sdkmanager on Java 11

Java EE has been deprecated in Java 9 and has been removed from Java 11.

So whenever you run sdkmanager from Java 9 onwards, you get this error message:

Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
        at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
        at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
        at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
        at com.android.sdklib.tool.SdkManagerCli.main(SdkManagerCli.java:103)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
        ... 4 more

You can find some internet hits when you search for:
java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema

Java 9 and 10 had the easy fix to add this line to your Java start commands:

set JAVA_OPTS=-XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee

As Java EE features have been removed, you have to add the libraries again yourself.

# Download JAXB
cd /opt
wget https://repo1.maven.org/maven2/com/sun/xml/bind/jaxb-ri/2.3.0/jaxb-ri-2.3.0.zip
unzip jaxb-ri-2.3.0.zip

# Download JAF
# Do this manually and place it into /opt
#https://www.oracle.com/technetwork/articles/java/index-135046.html
cd /tmp
unzip jaf-1_1_1.zip

# Now add the new classes to your classpath
set CLASSPATH=/opt/jaxb-ri/lib/jaxb-core.jar:/opt/jaxb-ri/lib/jaxb-impl.jar:/opt/jaxb-ri/lib/jaxb-api.jar:/opt/jaf-1.1.1/activation.jar:${CLASSPATH}

To verify if your sdkmanager now works, just run
sdkmanager --list