dpelle / vim-LanguageTool

A vim plugin for the LanguageTool grammar checker
280 stars 28 forks source link

NoClassDefFoundError #22

Open AdrienLemaire opened 4 years ago

AdrienLemaire commented 4 years ago

Hi and thanks for making this plugin. I'm really interested by it covering Japanese (although vim spellcheck doesn't).

I installed languagetool on arch linux, and added the vim config:

$ yay -Ql languagetool | rg commandline.jar
languagetool /usr/share/java/languagetool/languagetool-commandline.jar
" vimrc
Plug 'dpelle/vim-LanguageTool'  " grammar checker supporting japanese
let g:languagetool_jar='/usr/share/java/languagetool/languagetool-commandline.jar'
set spelllang=en_us
"set spelllang=ja

"Customize colors in colorscheme
hi LanguageToolGrammarError  guisp=blue gui=undercurl guifg=NONE guibg=NONE ctermfg=white ctermbg=blue term=underline cterm=none
hi LanguageToolSpellingError guisp=red  gui=undercurl guifg=NONE guibg=NONE ctermfg=white ctermbg=red  term=underline cterm=none

But when I try to run :LanguageToolCheck, I'm getting:

Error detected while processing function <SNR>37_LanguageToolCheck:
line   43:
Command [java -jar /usr/share/java/languagetool/languagetool-commandline.jar -c utf-8 -d WHITESPACE_RULE,EN_QUOTES -l en-US --api /tmp/nvimMCUuQC/10 2> /tmp/nvimMCUuQC/11] failed with error: 1
line   46:
['Error: Unable to initialize main class org.languagetool.commandline.Main', 'Caused by: java.lang.NoClassDefFoundError: org/languagetool/rules/Rule']

Your documentation mentions installing the latest version of languagetool, and I seem to be using the version 5

$ yay -Qii languagetool
Name            : languagetool
Version         : 5.0-1
Description     : An open source language checker
Architecture    : any
URL             : https://www.languagetool.org
Licenses        : LGPL
Groups          : None
Provides        : None
Depends On      : java-runtime-headless>=8
Optional Deps   : java-runtime: needed for the GUI version [installed]
                  libxtst: needed for the GUI version [installed]
                  gtk2: needed for the GUI version [installed]
Required By     : None
Optional For    : None
Conflicts With  : None
Replaces        : None
Installed Size  : 290.64 MiB
Packager        : Andrzej Giniewicz <gginiu@gmail.com>
Build Date      : Mon 29 Jun 2020 02:48:43 AM JST
Install Date    : Fri 11 Sep 2020 10:45:39 AM JST
Install Reason  : Explicitly installed
Install Script  : No
Validated By    : Signature
Backup Files    :
(none)
lf-araujo commented 3 years ago

I am getting this too, did you find a solution?

AdrienLemaire commented 3 years ago

unfortunately no

mb720 commented 3 years ago

I also ran into this issue. Here I found a pointer to vim-grammarous which also integrates LanguageTool into Vim and Neovim.

Here's what I did to get it running after having installed LanguageTool on Arch with pacman -S languagetool:

Since I use vim-plug, I added Plug 'https://github.com/rhysd/vim-grammarous' to init.vim (Neovim's equivalent to vimrc) and ran PlugInstall.

If you now run :GrammarousCheck on your buffer, it will download LanguageTool's jar file and check the text for English grammar mistakes.

Since we already have LanguageTool installed system-wide, we avoid that duplication of jar files by making vim-grammarous use the existing jar file by adding let g:grammarous#languagetool_cmd = 'languagetool' to init.vim or vimrc.

I don't know if vim-grammarous can use LanguageTool's feature to detect the language of text, which is why I specified the given language with :GrammarousCheck --lang=de. This checks the text in the current buffer for German grammar mistakes.

If vim-grammarous assumes the wrong language, it will report that no grammar mistakes were found. Meaning if your faulty text is German and you run :GrammarousCheck (without specifying the language it defaults to English) it will report there are no grammar mistakes.

shawywang commented 2 years ago

I am getting this now and haven't got any solution.

456Xander commented 1 year ago

For me, it worked, if I configured the plugin to use the /usr/bin/languagetool script instead of the jar. See #24