LangTool command does not work
yanivdll opened this issue · 7 comments
Hey,
I'm trying to get LangTool to work on my Emacs.
I'm using Mac, and have java 8 installed.
Got language tool from the official site, and Emacs-langtool from Melpa (version 20160116.1654).
I followed the readme, and tried each of the alternatives. Here's my current setup:
(use-package langtool
:ensure t
:init
(setq langtool-language-tool-jar "~/Downloads/LanguageTool-3.2/languagetool-commandline.jar")
(setq langtool-default-language "en-US"))
I always get the same error message:
LanguageTool exited abnormally with code 1 (Exception in thread "main" java.lang.NoClassDefFoundError: org/languagetool/commandline/Main)
I'm sure configuring something wrong, but can't figure out what.
Thanks. Yaniv
Did you tried to pass the absolute path to the .jar
file? without using the alias ~
.
Worked for me without issues.
The following works for me.
(require 'langtool)
(if (file-exists-p "/LanguageTool-3.4/")/LanguageTool-3.4/languagetool-commandline.jar"))
(setq langtool-language-tool-jar "
(global-set-key "\C-x4w" 'langtool-check)
(global-set-key "\C-x4W" 'langtool-check-done)
(global-set-key "\C-x4l" 'langtool-switch-default-language)
(global-set-key "\C-x44" 'langtool-show-message-at-point)
(global-set-key "\C-x4c" 'langtool-correct-buffer)
(setq langtool-default-language "en-US")
(setq langtool-mother-tongue "en")
railwaycat emacs port + melpa version of langtool
@yanivdll I had the same problem with it recently. My solution was to include /org
, /libs
and /META-INF
along with the languagetool-commandline.jar
. I thought the jar file was enough but it also needed those libraries to be beside it as well.
Thanks @FrancisMurillo. Where exactly did you put those references to /org
, /libs
and /META-INF
?
@yanivdll It is just the same as the extracted zip with only those files. The search path is where the languagetool-commandline.jar
is.
(setq langtool-language-tool-jar (expand-file-name "languagetool-commandline.jar" "~/.local/lib/LanguageTool-3.6") langtool-java-classpath nil)
The extracted and simplified ~/.local/lib/LanguageTool-3.6
contents
languagetool-commandline.jar
libs
META-INF
org
I just created a pull request on the readme where I added the info found here. I had the same issue. Thank you for the help @FrancisMurillo.
FWIW languagetool is available from homebrew, and might be a nicer way to install on macos.