Search code examples
javavisual-studio-codespring-tool-suite

JDK error in VS code spring boot extension


My vscode extension for spring boot is is not starting properly.

When I set the configuration as : "spring-boot.ls.java.home": "C:\\Program Files\\Java\\jdk1.8.0_311", I am getting the below error from the extension.

Error trying to find JVM: Error: Command failed: C:\Program Files\Java\jdk1.8.0_311\bin\java.exe --list-modules
Unrecognized option: --list-modules
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

When I set the configuration as : "spring-boot.ls.java.home": "C:\\Program Files\\Java\\jdk1.8.0_311\\jre", I am getting the below error from the extension.

Error trying to find JVM: Error: Command failed: C:\Program Files\Java\jdk1.8.0_311\jre\bin\java.exe --list-modules
Unrecognized option: --list-modules
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

How to resolve this. I have no issues with personal laptop configuration. I am configuring in client environment.


Solution

  • The Spring Tools for VSCode require a JDK >= 11 to run, so please let the configuration that you mentioned point to a JDK >= 11.

    Please note that this JDK is used to run parts of the Spring Tools and is independent of the JDK that you use to compile or run your projects on. You can continue to use a JDK 8 for that purpose.