Getting the Garmin Connect IQ SDK to work with Java 9, 10

If you’re developing with the Connect IQ SDK and have Java 9 or 10 installed (or any version beyond Java 8), you’ll probably run into an issue like this when trying to compile your app with monkeyc or run it with monkeydo, whether from the command line or the Eclipse Plugin:

$ monkeydo myApp.prg fenix5
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/DatatypeConverter
  at com.garmin.monkeybrains.prgreader.EntryPoint.parse(EntryPoint.java:71)
  at com.garmin.monkeybrains.prgreader.EntryPoints.parse(EntryPoints.java:21)
  at com.garmin.monkeybrains.prgreader.PrgParser.parse(PrgParser.java:50)
  at com.garmin.monkeybrains.monkeydodeux.MonkeyDoDeux.execute(MonkeyDoDeux.java:244)
  at com.garmin.monkeybrains.monkeydodeux.MonkeyDoDeux.main(MonkeyDoDeux.java:146)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.DatatypeConverter
  at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
  at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:190)
  at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
  ... 5 more Continued