mhayashi1120 / Emacs-langtool

LanguageTool for Emacs
GNU General Public License v3.0
378 stars 31 forks source link

LangTool command does not work #19

Open yanivdll opened 8 years ago

yanivdll commented 8 years ago

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

zzantares commented 8 years ago

Did you tried to pass the absolute path to the .jar file? without using the alias ~.

Worked for me without issues.

jasonhemann commented 8 years ago

The following works for me.

(require 'langtool)

(if (file-exists-p "~/LanguageTool-3.4/") (setq langtool-language-tool-jar "~/LanguageTool-3.4/languagetool-commandline.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

FrancisMurillo commented 7 years ago

@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.

yanivdll commented 7 years ago

Thanks @FrancisMurillo. Where exactly did you put those references to /org, /libs and /META-INF?

FrancisMurillo commented 7 years ago

@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
brandelune commented 7 years ago

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.

jasonhemann commented 2 years ago

FWIW languagetool is available from homebrew, and might be a nicer way to install on macos.