vscode-java: The Language Support for Java server crashed 5 times in the last 3 minutes. The server will not be restarted.

Receiving the following error when opening a Maven project folder:

The Language Support for Java server crashed 5 times in the last 3 minutes. The server will not be restarted.

Environment
  • Operating System: Windows 10

  • JDK version: both java version “1.8.0_141” AND openjdk version “11.0.1” 2018-10-16

  • Visual Studio Code version: Version: 1.29.1 (user setup) Commit: bc24f98b5f70467bc689abf41cc5550ca637088e Date: 2018-11-15T19:13:36.375Z Electron: 2.0.12 Chrome: 61.0.3163.100 Node.js: 8.9.3 V8: 6.1.534.41 Architecture: x64

  • Java extension version: 0.35.0 (November 30th, 2018)

Steps To Reproduce
  1. Install the Language Support for Java™ by Red Hat extension (no other extensions are active)
  2. Create a new Maven project using the quickstart archetype
  3. Open the folder with the new Maven project
  4. See the error

I am unable to attach the Java Language Server log file. I followed the steps here, but when I run the the Java: Open Java Language Server log file command nothing happens.

Current Result
Expected Result
Additional Informations

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 40 (3 by maintainers)

Most upvoted comments

Press CTRL + SHIFT + P, and type Java: Clean Java Language Server Workspace. It works for me.

Thank you for giving me the “java.jdt.ls.vmargs” setting, I was able to figure out what was going wrong.

I had installed the Lombok Annotations Support for VS Code extension awhile back and decided to remove it. However, the extension added some parameters to the java.jdt.ls.vmargs setting: "-noverify -Xmx1G -XX:+UseG1GC -XX:+UseStringDeduplication -javaagent:\"C:\\Users\\SHall\\.vscode\\extensions\\gabrielbb.vscode-lombok-0.9.7/server/lombok.jar\" -Xbootclasspath/a:\"C:\\Users\\SHall\\.vscode\\extensions\\gabrielbb.vscode-lombok-0.9.7/server/lombok.jar\""

When I removed the extension, the settings were still present but the Language Server was unable to the load the manifest from the lombok.jar file (because it was deleted). This caused the Language Server to fail to start.

After adding the -Dlog.level=ALL parameter to the java.jdt.ls.vmargs setting, I was finally able to see the error in the output view. I’ve put the java.jdt.ls.vmargs setting back to its default value and everything is working properly again.

Thank you for your help! You can close this issue.

Press CTRL + SHIFT + P, and type Java: Clean Java Language Server Workspace. It works for me.

image

Had this issue but Cleaning and Restarting the server did not fix it. (Note: Having a second vscode instance running another Java project may have suppressed the Cleaning process.) So I brought both instances down and just deleted my ~/.config/Code/User/workspaceStorage directory. Restarting my VsCode recreated it and all was good.

where is the ~/.config/Code/User/workspaceStorage in windows ?

i delete that folder , did not fix . i use windows, it is C:\Users\[username]\AppData\Roaming\Code\User

Had this issue but Cleaning and Restarting the server did not fix it. (Note: Having a second vscode instance running another Java project may have suppressed the Cleaning process.) So I brought both instances down and just deleted my ~/.config/Code/User/workspaceStorage directory. Restarting my VsCode recreated it and all was good.

I have tried all the above hacks nothing works as I tried to fix one another got breaked up… But here is a simple solution to realy get rid of this error.

  1. Unistall visual Studio code Editor.
  2. Go to the following directory: Windows: %APPDATA%\Code macOS: $HOME/Library/Application Support/Code Now Delete this code folder.
  3. Go to directory: C:\Users<username> Delete .vscode folder in it too.
  4. Now reinstall visual studio code editor and the extension.
  5. Now it will surely Work. You good to go.

I’d be curious if disabling the AV (probably wanna be offline for that) makes any difference. And I know nothing about AVs, except they can wreak havoc sometimes.

In your settings.json, try to :

  • set "java.trace.server":"verbose"
  • add -Dlog.level=ALL to the default “java.jdt.ls.vmargs” value

after restarting, get the Java server logs from VS Code’s Output view

@scotshall Could you try to remove

c:\\Users\\51140\\.vscode\\extensions\\redhat.java-1.7.0-win32-x64

and reinstall VS Code Java?

@snjeza , This item was resolved for me over 4 years ago. The recent comments are from other users experiencing similar, but different issues from mine.

the problem gets fixed by itself when I switched to the pre-release version of the extension. Thanks for your help anyway!!