Back to LanguageTool Homepage - Privacy - Imprint

[Solved] Can't be resolved to a type


#1

Hello,

I have added to my pom.xml:

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

And when I try to use:

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

it shows: Cannot be resolved to a type.

I am not sure if another dependency is needed.

Thanks!


(Daniel Naber) #2

That's the only dependency you need. languagetool-core is needed, but language-en will get that automatically. Is the text you posted really the complete error message? What IDE are you using, or is this on the command line?


#3

Hi and thanks for the help.

Yes, this is the only and full error message:

BritishEnglish cannot be resolved to a type

I am using eclipse oxygen (4.7.0).


(Daniel Naber) #4

This sounds like Eclipse doesn't realize you've updated your pom.xml or so. You could try Languages.getLanguageForShortCode("en-GB") instead of new BritishEnglish(). If that doesn't help, I think this is more of an Eclipse/Maven issue than a LT issue.


#5

Ok, thanks! It works now!
Probably something with maven update issue, I don't know.

Where can I found the language abbreviations?
For example, in order to use AmericanEnglish?

Thanks!


(Daniel Naber) #6

Use java -jar languagetool-commandline.jar --list to get a list of language codes supported by LT.


#7

Ok, thanks!