ClassNotFoundException: org.javacs.Main when called with absolute path on MSYS2
I can call lang_server_windows.sh with a relative path, but get an exception when I use an absolute one.
ex@EX MINGW64 /c/bin/java-language-server-master/dist
$ ./lang_server_windows.sh
15:56:19.573 INFO LSP connect Reading messages from queue...
15:56:19.573 INFO LSP$1MessageReader run Placing incoming messages on queue...
ex@EX MINGW64 /c/bin/java-language-server-master/dist
$ /c/bin/java-language-server-master/dist/lang_server_windows.sh
Error: Could not find or load main class org.javacs.Main
Caused by: java.lang.ClassNotFoundException: org.javacs.Main
My environment is an MSYS2 shell on Windows 7.
lang_server_windows.sh calls launch_windows.sh which constructs the classpath like so:
https://github.com/georgewfraser/java-language-server/blob/d9c8c8658780e5f3681d8dd3ed94d35de5cfac6f/dist/launch_windows.sh#L12
$DIR comes from dirname and I'm guessing there's something different about the behavior of dirname under msys2.
Oh, got it. dirname gives a path starting in /c/... (the MSYS2 file system model) which is probably not how java likes it.
I think this shows an underlying problem: The documentation is not all that clear about the preferred environment on Windows. Since we're running Bash scripts and GNU binaries, I thought MSYS2 should be an acceptable way to do it. No idea what you're using.
I'm a mac user, but I've tested the vscode implementation in windows under the normal windows command line.
Ideally, these scripts should work in msys2, cygwin, whatever. If you figure out what's going wrong, I'd very much appreciate a PR.
Looks like Windows 10 comes with Bash, or maybe you need to install WSL. So the instructions should work if you just add bash to calling the script. If you want to support Windows 8 you would need some extra steps in the instructions, though I'm not sure it's worth the hassle. I won't have the time to write a PR any time soon, unfortunately.