What is the exception?
Actually I wasn’t very clear: I m getting a general IOexception calling the initial function that was working fine(I didn’t change a single line).
The problem is located just before the creation of the LanguageTool object , I just call my function in a servlet , everything else works fine in my project,the appropriate jar files are included , I just can’t use the specific function for the spelling correction and I don’t know how to catch a more detailed exception in order to solve it due to my poor java skills.
Thank you again for your time
Well, you’ll need the full exception with a stacktrace to debug this. It might be written to a log file or printed to the console.
This is the error :
" Caused by: java.lang.RuntimeException: Problems with loading disambiguation file: /org/languagetool /resource/en/disambiguation.xml
at org.languagetool.JLanguageTool.getAnalyzedSentence(JLanguageTool.java:732) "
" Caused by: java.lang.IllegalArgumentException: ‘en’ is not a language code known to LanguageTool. Supported language codes are: xx-XX "
using the same jars in the library I don’t face this problem in my initial program.
Thank you in advance for any help
You need to have in your classpath:
- All language resources, like org/languagetool/resource/en/disambiguation.xml
- All language classes you want to use, like org/languagetool/language/English.java
- META-INF/org/languagetool/language-module.properties (see ‘Supported Languages’ at http://wiki.languagetool.org/java-api)
If you have downloaded the LanguageTool ZIP, just add everything under “org” and “META-INF” to your classpath.
actually i am also facing same error.
but go through this site i can’t understand.
“zip -r languages.jar org/”—how do i use?.
can you please explain me clearly?
After “zip -r languages.jar META-INF/ org/” you need to add languages.jar to your classpath. How to do that exactly depends on your local environment or IDE.
zip -r languages.jar org/ when used on command mode it shows error as
“zip is not recognized as an internal or external command”.
Is that to be used in command mode. Please explain.
Also, If i zip the Org folder and create it as a jar, i cannot import it in my java code.
Thanks in advance.
I was having the same exact problem with my IDE not being able to find the BritishEnglish class. I have made the the language folder into a jar and added it the libraries the same way I did with the other JAR files. I also made the language-module under META-INF/org a jar file and added that as well.
I was able to get Language Tools to run as a standalone so I should have everything necessary and I believe I have put everything from the language tools program in my project classpath.
Sorry for being so specific but I have been trying for the past three days to get LT to work, I even tried using maven but was getting many more errors that I was having trouble figuring out the meaning of.
Thank you in advance,
You’d need to make the top-level
org directory a JAR file, not the one below
META-INF. But even that isn’t needed, as long as you simply add the top-level
org to the classpath (together with all the JARs in the
I have added the top level org as well as all the JARS in the libs and the program still won’t compile. The only error i am getting is with the British English. I’ve tried JAR ing the language folder as well as the BritishEnglish.class and adding that but still I am having no luck. I do not understand what I could be doing wrong. Please let me know if you have any ideas.
Is also coming up saying it is an unused import, so it seems obvious that the program cannot find the BritishEnglish.class in the languages folder but I don’t know why.
I would say managing jars manually in Java projects is not recommended exactly for this reason: it’s really time-consuming to do it right and it’s really easy to break it if something changes.
Maven and Gradle are excellent build systems that make things so much easier and they will make sure your build is correct and all the necessary jars with correct versions are pulled in.
I was originally trying to use Maven but have no experience with it and was getting multiple error messages. I started with a simple Hello World Maven app and then tried adding the dependency and code that the API suggests but still couldn’t get the program to compile. The last error it gives is MojoFailureException, which when you look up, tells me the problem is something with the plugin I am trying to use. I tried scrolling through errors to see the source of the problem but cannot even get all of them because the command prompt cuts off some of them due to how many there are.
How add LT.jar to eclipse
LanguageTool pluging for Eclipse
I’ve created a little example program: 20 lines in java and 10 lines gradle file: http://r2u.org.ua/data/tmp/lt-client-example.zip
Download it, unpack it, install gradle and run ‘gradle runIt’ - it will pull LanguageTool dependency, compile Java client, and run it.
After that you can modify it to your needs.
If need help with use in Java i can help u too. Im working in a java project with LanguageTool, Apache POI, iText, VRaptor and Hibernate in Maven. If need some help about i will like to help u.
Best Regards - Matheus Poletto
Thank you so much, I finally have it compiling and running on my machine.
I have been taking some of the tutorials gradle offers and it seems like a great tool.
Thank you for you help.
Thank you guys for your valuable comments… I still have a problem, maybe bcz I do not have experiences dealing with Gradle. What I have understood is that I can built a jar file using Gradle then use the jar in my java application and that what I have done but still there are errors.
When I open the jar file in NetBeans, it has no libraries therefore it does not recognize any of the tool’s objects.
I already have a many classes and machine learning algorithms which have been written using NetBeans for text processing and I need to add a spelling processing to the project.
Can I get some help and explanation… Thank you very much
Did you add the jar into your project folder and reference it into project java build path?