Different JVM, most probably you have Java 9+ in terminal, which doesn't include javax.xml anymore
It works in AS because by default it uses bundled JVM which is based on Java 8
gildor
07/16/2019, 1:55 PM
Also most probably one of your build tools doesn't support java 9+ (old Gradle, old Kotlin plugin, some Gradle plugin, annotation processor etc)