Back to LanguageTool Homepage - Privacy - Imprint

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


(hiacine) #1

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)


(Daniel Naber) #2

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


(hiacine) #3

oups

debian x64

openjdk version "1.8.0_72-internal"


(Daniel Naber) #4

Could you try if using Oracle JDK makes a difference?


(hiacine) #5

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 ?


(hiacine) #6

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 ?


(Daniel Naber) #7

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.