Search code examples
javanetbeans-8languagetool

can not find symbol Language.ENGLISH


I am using jlanguagetool for checking grammar of my text and I am new to this. I have added langaugetool-core-2.5.jar in libraries. But I get error in this line of code
JLanguageTool langTool = new JLanguageTool(Language.ENGLISH);
at ENGLISH, saying "can not find symbol". What could be the reason for that? Am I using wrong jar file?


Solution

  • The way you try to initialize the JLanguageTool is invalid. Correct way of initializing the JLanguageTool is

    JLanguageTool langTool = new JLanguageTool( new BritishEnglish());

    BritishEnglish is available in the dependency

    <dependency>
     <groupId>org.languagetool</groupId>
     <artifactId>language-en</artifactId>
     <version>2.5</version>
    </dependency>
    

    Note : Please go through the complete documentation before start the development as @Jim Garrison mention.

    Additional Dependencies Additional Dependencies