Following the minimal example provided at Embedding LanguageTool in Java applications | dev.languagetool.org, I added the following Maven dependency to my pom.xml: <dependency> <groupId>org.languagetool</groupId> <artifactId>language-en</artifactId> <version>6.6</version> </dependency>
and attempted to do the basic text checking with a JLanguageTool object.
This builds but throws an error: Class ‘org.languagetool.language.English’… not found in classpath.
Adding requires language.en to module-info resolves this error, but causes build to fail with: java: module org.apache.poi.poi reads package org.languagetool.chunking from both languagetool.core and language.en
Which Java version are you using? As you linked some issues related to Java 11, I guess you are using Java 11 as well. Java 11 is not supported by LT 6.6. You need to use at least Java 17 or use LT 6.5.
Hi! This is a classic Java Module System (JPMS) split package issue.
LanguageTool artifacts historically share internal packages. In traditional classpath mode Java allows this, but JPMS strictly forbids two named modules from exporting the exact same package.
Here are a few ways to resolve this:
Option 1: Treat LanguageTool as Automatic Modules (Recommended)
Remove explicit requires language.en; from your module-info.java and let LanguageTool sit on the classpath.
Option 2: Explicitly Align Dependency Versions in pom.xml
Ensure languagetool-core and language-en use the exact same version: