Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Troubleshooting

Roland Grunberg edited this pageOct 26, 2022 ·13 revisions

Here are a few instructions to help troubleshoot vscode-java.

Clean the workspace directory

In some occasions, deleting the Java Language Server workspace directory is helpful to go back to a clean slate.Generally speaking, on the different platforms, the VS Code user workspace storage area can be found under these locations :

  • Windows :%APPDATA%\Code[ - Variant]\User\workspaceStorage\
  • MacOS :$HOME/Library/Application Support/Code[ - Variant]/User/workspaceStorage/
  • Linux :$HOME/.config/Code[ - Variant]/User/workspaceStorage/

New in 0.33.0

You can clean the workspace directory in the following way:

  • Open the command palette (F1)
  • selectJava: Clean the Java Language Server Workspace
  • selectRestart and delete from the confirmation prompt

Enable logging

When the Java extension fails to work as expected, reading the logs is quite often a good way to understand what the problem is. The Java extension for VS Code is composed of 2 main parts, the client (VS Code) and the server (eclipse.jdt.ls), which means important information can be logged on both components.

Turn on message tracing between VS Code and the Java Language Server

It can be useful to trace the communications between VS Code and the Java Language Server. This can be achieved by enabling tracing in VS Code settings. Thejava.trace.server configuration can be set toverbose to provide full message logging in the Output view (selectLanguage support for Java in the view menu).java.trace.server can take 3 values:

  • off : no trace
  • messages : logs messagetypes exchanged between VS Code and the java server
  • verbose : logsJSON messages exchanged between VS Code and the java server

Get the vscode-java logs

When the Java extension fails to start, the first thing to look at is the VS Code console.

  • Open the command palette (F1)
  • selectDeveloper: Toggle Developer Tools

The chrome developer tools will open. In the console tab, you will find messages like:

stderr: Mar 30, 2017 3:54:00 PM org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint notifyWARNING: Unsupported notification method: $/setTraceNotificationvscode-icons is active!Executing /Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home/bin/java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=1044 --add-modules=ALL-SYSTEM --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED -Declipse.application=org.eclipse.jdt.ls.core.id1 -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -Dlog.protocol=true -Dlog.level=ALL -noverify -Xmx1G -make.it.crash -jar /Users/fbricon/Dev/projects/vscode-java/server/plugins/org.eclipse.equinox.launcher_1.4.0.v20161219-1356.jar -configuration /Users/fbricon/Dev/projects/vscode-java/server/config_mac -data /Users/fbricon/Library/Application Support/Code/User/workspaceStorage/bdea6df99b92680f795ba5759e96cfc4/redhat.java/jdt_wsView server logs at /Users/fbricon/Library/Application Support/Code/User/workspaceStorage/bdea6df99b92680f795ba5759e96cfc4/redhat.java/jdt_ws/.metadata/plugins/.logstderr: Unrecognized option: -make.it.crashError: Could not create the Java Virtual Machine.Error: A fatal exception has occurred. Program will exit.

Get the Java Language Server's workspace logs

The Java Language Server log file might also contain other informations. To access it:

  • Open the command palette (F1)
  • selectJava: Open Java Language Server log file

It will open the Java Language Server log file in a new tab.

Turn off lombok support

Lombok support is enabled by default so that projects may take advantage of this immediately. However, in some cases, it may interfere with the reporting of some errors. Disabling it temporarily ("java.jdt.ls.lombokSupport.enabled": false) when attempting to uncover failures can help.

Clone this wiki locally

[8]ページ先頭

©2009-2025 Movatter.jp