Back to LanguageTool Homepage - Privacy - Imprint

LT and Java 9

(Daniel Naber) #1

The release of Java 9 is probably only a few months away. If you try to run LT with a current release of Java 9, you'll get a java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException at start. The solution is to add --add-modules java.xml.bind when running LT. For example:

java --add-modules java.xml.bind -jar languagetool.jar

I understand the problem is caused by Java 9's new module system which causes some packages like java.xml.bind to be not accessible by default. I'm not sure yet whether there will be a good fix as long as we're still using and supporting Java 8.

(Daniel Naber) #2

It seems this still happens with the final release version of Java 9, the suggested workaround also still works. But I don't have time now to search for a real fix.

(Andriy) #3

It looks like the fix for this is to add jaxb-api into pom.xml, then both jdk8 and jdk9 will be able to find it.
That seemed to work for my quick test.

diff --git a/languagetool-core/pom.xml b/languagetool-core/pom.xml
index 0150c24..106f1dc 100644
--- a/languagetool-core/pom.xml
+++ b/languagetool-core/pom.xml
@@ -171,6 +171,13 @@
+        <dependency>
+            <groupId>javax.xml.bind</groupId>
+            <artifactId>jaxb-api</artifactId>
+            <version>2.3.0</version>
+        </dependency>


(Daniel Naber) #4

Thanks, could you commit this change?

(Andriy) #5

Pushed, please let me know how it works for you.

(Andriy) #6

Interestingly my tests (both languagetool-standalone and manual bia languagetool-commandline) worked with JDK9 but maven install target fails with

Error injecting: org.codehaus.plexus.archiver.jar.JarArchiver
So we need to do some more research to support development with JDK9.