Skip to content

ClassNotFoundException on Windows when user path contains spaces #150

@UrielCuriel

Description

@UrielCuriel

Relevance Confirmation

  • I confirmed that this is not an issue with the Eclipse JDT Language Server itself

What happened?

When attempting to use the Java extension on Windows with a user profile path that contains spaces (e.g., C:\Users\U. Fernando Curiel), the language server fails to start.

The error occurs because the paths passed to the -javaagent (for Lombok) and -Dosgi.sharedConfiguration.area arguments are not quoted. This causes the Java process to interpret parts of the path as the main class name.

In the logs, this manifests as a ClassNotFoundException for the part of the name after the space:

2025-12-16T10:47:18-06:00 ERROR [project::lsp_store] Failed to start language server "jdtls": initializing server jdtls, id 3

Caused by:
    Request timed out
2025-12-16T10:47:18-06:00 ERROR [project::lsp_store] server stderr: Error: Could not find or load main class Fernando
Caused by: java.lang.ClassNotFoundException: Fernando

The complete command being executed shows the issue clearly:

2025-12-16T10:45:18-06:00 INFO  [lsp] starting language server process.  
binary path: "C:\\nvm4w\\nodejs\\node.exe", 
working directory: "C:\\Users\\U.  Fernando Curiel\\Projects\\project-path", 
args: [
  ...  
  "-Dosgi.sharedConfiguration.area=C:/Users/U.  Fernando Curiel/AppData/Local/Zed/extensions/work/java/jdtls/jdt-language-server-1.54.0-202511261751/config_win",
  ... 
  "-javaagent:C:/Users/U. Fernando Curiel/AppData/Local/Zed/extensions/work/java/lombok/lombok-1.18.42.jar",
  ...
  "-data", "C:\\Users\\U.  Fernando Curiel\\AppData\\Roaming/jdtls-b3a104c2a1ab92211ad20991f09dd4df8cc15997"
]

What did you expect to happen?

The language server should start correctly regardless of whether the user's path contains spaces or not. The extension should properly quote paths in arguments passed to the Java process to handle this scenario on Windows.

Environment

Zed: v0.216.1
Platform: Windows 11
Java: OpenJDK 21.0.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    language-serverRelated to the language server.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions