Back to LanguageTool Homepage - Privacy - Imprint

IOException


(arjun1992) #1

Hello all,

I am using language tool api provided by you languagetool.jar. I have put all jars in class path also make jar for org directory and put it on class path but still i get an exception like,

Exception in thread "main" java.io.IOException: Cannot load or parse input stream of '/org/languagetool/rules/en/grammar.xml'
at org.languagetool.rules.patterns.PatternRuleLoader.getRules(PatternRuleLoader.java:74)
at org.languagetool.JLanguageTool.loadPatternRules(JLanguageTool.java:334)
at org.languagetool.JLanguageTool.activateDefaultPatternRules(JLanguageTool.java:370)
at Tester.main(Tester.java:13)
Caused by: java.lang.IllegalArgumentException: 'en' is not a language code known to LanguageTool. Supported language codes are: xx-XX
at org.languagetool.Language.getLanguageForShortName(Language.java:459)
at org.languagetool.rules.patterns.PatternRuleHandler.startElement(PatternRuleHandler.java:103)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$ContentDriver.scanRootElementHook(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.languagetool.rules.patterns.PatternRuleLoader.getRules(PatternRuleLoader.java:71)
... 3 more

Thanks in advance


(Daniel Naber) #2

You need a
language-module.properties
file. This is documented at http://wiki.languagetool.org/java-api.


(arjun1992) #3

I have put that file in class path of my java project but it still give that exception.


(Daniel Naber) #4

Did you put it to
META-INF/org/languagetool/language-module.properties
?


(arjun1992) #5

yes like this...


(arjun1992) #6

and also i build this file in class path in run configure


(Daniel Naber) #7

Placing the META-INF directly into 'Demo' will only work if 'Demo' itself (not just Demo/src) is actually in the classpath. Are you sure it is?