question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Crashes on Arch Linux `NoSuchFileException: /usr/java`

See original GitHub issue

On my machine, the folder /usr/java does not exist, and apparently that crashes the server (logs below).

I can see that in the JavaHomeHelper class, some folders are tested for the presence of ‘bin/javac’, however, the check crashes if the searched folder doesn’t even exist (line).

I’m not sure what the purpose is of that rethrow, as in my opinion an exception in that place should just signal the checker to move on to another entry. Replacing the throw new RuntimeException(e) with continue fixes the problem.

Full log:

14:19:09.050	INFO	LSP connect	Reading messages from queue...
14:19:09.050	INFO	LSP$1MessageReader run	Placing incoming messages on queue...
14:19:09.199	SEVERE	LSP connect	Not a JSON Object: null
java.lang.IllegalStateException: Not a JSON Object: null
	at com.google.gson.JsonElement.getAsJsonObject(JsonElement.java:91)
	at org.javacs.JavaLanguageServer.didChangeConfiguration(JavaLanguageServer.java:217)
	at org.javacs.lsp.LSP.connect(LSP.java:288)
	at org.javacs.Main.main(Main.java:30)

14:19:09.415	INFO	JavaLanguageServer lint	Lint 1 files...
14:19:09.468	INFO	ScanClassPath jdkTopLevelClasses	Searching for top-level classes in the JDK
14:19:09.665	INFO	ScanClassPath jdkTopLevelClasses	Found 5794 classes in the java platform
Class path:
Doc path:
14:19:09.735	SEVERE	Main main	java.nio.file.NoSuchFileException: /usr/java
java.lang.RuntimeException: java.nio.file.NoSuchFileException: /usr/java
	at org.javacs.JavaHomeHelper.check(JavaHomeHelper.java:84)
	at org.javacs.JavaHomeHelper.linuxJavaHome(JavaHomeHelper.java:62)
	at org.javacs.JavaHomeHelper.javaHome(JavaHomeHelper.java:30)
	at org.javacs.Docs.findSrcZip(Docs.java:53)
	at org.javacs.Docs.srcZip(Docs.java:39)
	at org.javacs.Docs.<init>(Docs.java:18)
	at org.javacs.JavaCompilerService.<init>(JavaCompilerService.java:37)
	at org.javacs.JavaLanguageServer.createCompiler(JavaLanguageServer.java:112)
	at org.javacs.JavaLanguageServer.compiler(JavaLanguageServer.java:39)
	at org.javacs.JavaLanguageServer.lint(JavaLanguageServer.java:61)
	at org.javacs.JavaLanguageServer.doAsyncWork(JavaLanguageServer.java:523)
	at org.javacs.lsp.LSP.connect(LSP.java:247)
	at org.javacs.Main.main(Main.java:30)
Caused by: java.nio.file.NoSuchFileException: /usr/java
	at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
	at java.base/sun.nio.fs.UnixFileSystemProvider.newDirectoryStream(UnixFileSystemProvider.java:432)
	at java.base/java.nio.file.Files.newDirectoryStream(Files.java:475)
	at java.base/java.nio.file.Files.list(Files.java:3762)
	at org.javacs.JavaHomeHelper.check(JavaHomeHelper.java:81)
	... 12 more


Process NOX (stepavo2/java-mode) stderr finished

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
drybalkacommented, Jun 25, 2021

It seems this issue can be closed now, as it was solved in https://github.com/georgewfraser/java-language-server/pull/148 On Arch just be sure to use the “java-language-server-git” package, as the release version is lagging behind and still does not include the fix.

0reactions
ribrdbcommented, Jul 22, 2020

I’m getting this problem also on debian. Wouldn’t it be better to use bazel to get the JAVA_HOME in addition to just the dependencies for bazel projects?

Read more comments on GitHub >

github_iconTop Results From Across the Web

[solved] Java crashing after update / Newbie Corner / Arch ...
I have installed openjdk6-compat and it seems to be fine. I tried freecol and just run. Some packages installed extra/jdk7-openjdk 7.u40_2.4.0-1
Read more >
[Arch Linux] Crash on startup when launched from Steam
Running the game from steam makes the game crash immediately, but launching the .sh script from the terminal works just fine.
Read more >
Java crashes on boot on Arch-Linux : IDEA-146410
I'm running Arch Linux and am fully updated. This is really grinding me to a halt. $ phpstorm-eap. Java HotSpot(TM) 64-Bit Server VM...
Read more >
Software Keeps Crashing on Arch Linux - Stack Overflow
Most common crashes come from individual chrome pages or visual studio code which show SIGSEGV or SIGILL error codes. Looking at log, I...
Read more >
System crashes since Linux 6.0.1 : r/archlinux - Reddit
73 votes, 43 comments. Hi everyone First of all, system info: CPU: i7-9750H GPU: GTX 1660Ti (Mobile) RAM: 16GB Kernel version: 6.0.1.arch1-1 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found