Back to LanguageTool Homepage - Privacy - Imprint

Failed to load built-in Java rules for language XYZ


(padmalcom) #1

I'm trying to integrate LanguageTool in my Java web application. I'm using Maven as shown in your documentation:

http://www.languagetool.org/java-api/

When I add the dependency as shown there, I get an exception telling me that the rules for language XYZ could not be loaded. I tried several languages and get - everytime - the same error.

Is there anything I forgot to do? Or did anybody else have this problem?

EDIT: I did not add any *.lib files to my project since I expect maven to handle all dependencies. Is that correct?


(Daniel Naber) #2

When I add the dependency as shown there, I get an exception telling
me that the rules for language XYZ could not be loaded.

Could you post the complete error message?

Regards
Daniel


(padmalcom) #3

Hi Daniel, I already fixed it. Next to the maven dependency it is REQUIRED to add all *.lib files from the lib directory from the current release e.g. "LanguageToo-2.2.zip".

Regards,
Jonas

EDIT: Unfortunately, the result is not very good. The errors in the following sentences are not detected "Bekomme ich einen Studienplattz, bekommen Sie einen l├Ąckeren Schokokuchen!". Nevertheless, thank you for the effort you put in this library!


(Daniel Naber) #4

When I add the dependency as shown there, I get an exception telling
me that the rules for language XYZ could not be loaded.

Your class path needs to contain files named
META-INF/org/languagetool/language-module.properties, with content like
this:

languageClasses=org.languagetool.language.German,org.languagetool.language.GermanyGerman

These files should already be part of the language-specific JARs, e.g.
languagetool-de-2.2.jar.

Regards
Daniel


(padmalcom) #5

Adding the language-module.properties is not sufficient. When I remove all the libs like "morfologic-stemming.jar, ..." I get an error telling me that the rules cannot be loaded.

You are talking of a "languagetool-de-2.2.jar", can I download this file somewhere? I couldn't find it.

Last but not least, the bad results were my fault, I initializted JLanguageTool with "new German()" instead of "new GermanyGerman()" which finds the errors!


(Daniel Naber) #6

You are talking of a "languagetool-de-2.2.jar", can I download this
file somewhere? I couldn't find it.

Maven should automatically download those files (if you specified e.g.
language-de as a dependency in your pom.xml) for you and put them in
your *.war file.

Regards
Daniel