Back to LanguageTool Homepage - Privacy - Imprint

A little question about java api

(FontaineG) #1

I’m trying to use languagetool into my java app, but when I tried to first use it, I met a problem.
When I use check(String text) method, the IDE showed me that there was a, I don’t know why because I almost copied the code from documents. Here is my code

My dev environment is win10 Pro, using IntellJ idea with Jdk 10.0.1

import org.languagetool.JLanguageTool;
import org.languagetool.language.AmericanEnglish;
import org.languagetool.rules.RuleMatch;

import java.util.List;
import java.lang.String;

public class mainWin {
public mainWin()

public static void main(String[] args)

    JLanguageTool langTool = new JLanguageTool(new AmericanEnglish());

    List<RuleMatch> matches = langTool.check("Or a important post in facebook"); // I faced the problem here, IDE showed me,ioexception.

    for(RuleMatch match : matches)
        System.out.println("Potential error at characters " +
                match.getFromPos() + "-" + match.getToPos() + ": " +
        System.out.println("Suggested correction(s): " +

Thanks for checking my question !

(FontaineG) #2

I have got where the problem is, it because I didnt add “throws IOException” after the main()