Could not initialize class com.sun.jna.Native in French and German

Hi,

I’m under debian 7
using netbeans in java

my dependencies are

       <dependency>
        <groupId>org.languagetool</groupId>
        <artifactId>languagetool-core</artifactId>  
        <version>3.6</version>
    </dependency>
    <dependency>
        <groupId>org.languagetool</groupId>
        <artifactId>language-all</artifactId>
        <version>3.6</version>
    </dependency>

my code

JLanguageTool langTool = new JLanguageTool(new French());
List matches = langTool.check(“je suis un texte”);

I have this error

Exception in thread “main” java.lang.NoClassDefFoundError: Could not initialize class com.sun.jna.Native
at org.languagetool.rules.spelling.hunspell.Hunspell.(Hunspell.java:127)
at org.languagetool.rules.spelling.hunspell.Hunspell.getInstance(Hunspell.java:68)
at org.languagetool.rules.spelling.hunspell.Hunspell.getInstance(Hunspell.java:54)
at org.languagetool.rules.spelling.hunspell.HunspellRule.init(HunspellRule.java:183)
at org.languagetool.rules.spelling.hunspell.HunspellRule.match(HunspellRule.java:83)
at org.languagetool.JLanguageTool.checkAnalyzedSentence(JLanguageTool.java:644)
at org.languagetool.JLanguageTool$TextCheckCallable.call(JLanguageTool.java:991)
at org.languagetool.JLanguageTool$TextCheckCallable.call(JLanguageTool.java:943)
at org.languagetool.JLanguageTool.performCheck(JLanguageTool.java:606)
at org.languagetool.JLanguageTool.check(JLanguageTool.java:558)
at org.languagetool.JLanguageTool.check(JLanguageTool.java:508)
at org.languagetool.JLanguageTool.check(JLanguageTool.java:504)
at com.ve.poc.languagetool.LanguageProcess.test1(LanguageProcess.java:19)
at com.ve.poc.languagetool.Main.main(Main.java:28)

What’s the output of java -version? I assume LT runs for you outside the development environment?

oups

debian x64

openjdk version “1.8.0_72-internal”

Could you try if using Oracle JDK makes a difference?

I’ve just tested on windows 10 x64
java version “1.8.0_121”

the cause might be openjdk

Can I run it under openjdk ?

I’ve compiled the same code under debian and jdk 1.8
It’s working.

But the problem is that we are working with openjdk.

is there a way to make it work with it ?

I just tried running LT in IntelliJ using OpenJDK 1.8.0_121 (the one that comes with Ubuntu 16.04) and it worked for me.