Skip to content

Error while verifying JDK #7978

@yaskor

Description

@yaskor

Apache NetBeans version

Apache NetBeans 23

What happened

Issue: Error displayed incorrectly when verifying the JDK version

The issue occurs when the file path to the JDK contains spaces. For example, in my case:
c:\Program Files\Eclipse Adoptium\jdk-21.0.5.11-hotspot\bin\java

Cause is in
netbeans/java/java.lsp.server/vscode/src/extension.ts
The error can be resolved by modifying the function that calls findJDK to add quotation marks around javaExecPath:

let javaCheck = spawnSync(${javaExecPath} -version, { shell: true });

// Change to:
let javaCheck = spawnSync("${javaExecPath}" -version, { shell: true });

Language / Project Type / NetBeans Component

VS-Code Extension

How to reproduce

Start Netbeans-VS-Code Plugin in VS-Code
Configure JDK
The issue occurs when the file path to the JDK contains spaces. For example, in my case:

Did this work correctly in an earlier version?

No / Don't know

Operating System

Windows 11 x64

JDK

JDK 21

Apache NetBeans packaging

Apache VSNetBeans for VSCode

Anything else

No response

Are you willing to submit a pull request?

Yes

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions