Back to LanguageTool Homepage - Privacy - Imprint

How use langugetool in a servlet

(Laotshi) #1

Hi everyone, I tried use langugetool in a servlet, but show two error:

  1. Could not initialize class com.sun.jna.Native
    java.lang.NoClassDefFoundError: Could not initialize class com.sun.jna.Native
    at org.languagetool.rules.spelling.hunspell.Hunspell.(
    at org.languagetool.rules.spelling.hunspell.Hunspell.getInstance(
    at org.languagetool.rules.spelling.hunspell.Hunspell.getInstance(
    at org.languagetool.rules.spelling.hunspell.HunspellRule.init(
    at org.languagetool.rules.spelling.SpellingCheckRule.resetIgnoreTokens(…

  2. java.lang.UnsupportedClassVersionError: org/languagetool/Language : Unsupported major.minor version 51.0
    java.lang.ClassLoader.defineClass1(Native Method)

I want use languagetool in a servlet, How can do it?.

Best regards.

(Daniel Naber) #2

1.) It seems jna.jar is missing in your classpath for some reason.

2.) You will need Java 7. If you are still on Java 6 you can only use LanguageTool 2.2 or earlier.

(Werzi2001) #3

Hi dnaber,

i have the same problem as state by 1. of Laotshi. I already tried putting the jna.jar and hunspell-native-libs.jar into the WEB-INF/lib and TOMCAT_HOME/lib directories but with no success.

Any idea why the class is not found (or could not be initialized)?


(Daniel Naber) #4

Hi Werzi2001, which version of LanguageTool, Java and Tomcat do you use? Which operating system?

(Werzi2001) #5

Wow that was fast. And it immediately gave me the right hint. I was not using the Oracle JRE 7 but the OpenJDK one. I switched to the original one and now it is running.

Thanks for giving me the right questions :wink: