Accepted answer
  1. Open [File -> Settings -> Build, Execution, Deployment -> Compiler]
  2. Add "--add-modules" to [Shared build process VM options]


In addition to @nullpointer answer, short instruction how to use --add-modules

Open File -> Settings -> Build, Execution, Deployment -> Compiler, and add --add-modules java.xml.bind to Shared build process VM options

enter image description here


In addition to the above answers.

If you are not using IntelliJ and running the program from sbt console, I found the following resolved the issue:

  • Adding the following to your build.sbt:

    libraryDependencies += "javax.xml.bind" % "jaxb-api" % "2.3.0"

  • Adding the import statement to your controller:

    import javax.xml._


Moving this as an answer to serve as a temporary suggestion unless there is a definite solution to it and to club together few other points.

Seems like is not yet complete in terms of readiness to be used with JDK-9 as visible at scala/scala-dev - Support JDK 9

On the other hand, the way of solving the dependency on the javax.xml.bind could be currently categorized into two categories:-

  • Your project uses a library which in turn requires javax.xml.bind, in which case there is not much in your hands other than waiting for that library to move to a modular structure prior to your restructuring. However, this can then be temporarily hacked by the --add-modules javax.xml.bind option provided as the compiler argument.

  • Your project makes use of the javax.xml.bind directly. In which case the ideal solution is to move away from the module and make use of the dependency[jaxb-api:2.3.0] and refactor code accordingly.

Related Query

More Query from same tag