Back to LanguageTool Homepage - Privacy - Imprint

Java exception with serverMode and set but missing ngrams dir

Hi all!
I am on Arch Linux x86_64 with both latest Java (jre-openjdk 14.0.1.u7-1), Java8 (jre8-openjdk 8.u252-1, do I need also JDK 8 or JRE 8 is enough?) and LanguageTool 4.9.1.

Some time ago I installed ngrams (from AUR), I set the desktop application to use it but after some time I uninstalled the ngrams. Until here everything continued working fine.

Then I enabled the “Run as server” serverMode and every time I try to open languagetool desktop application I get a Java exception instead:

$ languagetool         
Not loading ngram data, directory does not exist: /usr/share/ngrams/en
java.lang.RuntimeException: LanguageModel directory not found or is not a directory: /usr/share/ngrams
	at org.languagetool.server.HTTPServerConfig.setLanguageModelDirectory(HTTPServerConfig.java:375)
	at org.languagetool.gui.Main.maybeStartServer(Main.java:917)
	at org.languagetool.gui.Main.createGUI(Main.java:578)
	at org.languagetool.gui.Main.access$1700(Main.java:144)
	at org.languagetool.gui.Main$7.run(Main.java:1203)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:316)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

In order to reproduce, set the ngrams directory and enable the serverMode, then rename the ngrams directory so that languagetool cannot access it.

Otherwise, simply use the following ~/.languagetool.cfg:

ngramDir=/non/existent/dir
serverMode=true