Home > other >  Cannot run java file in VS code in Zorin OS
Cannot run java file in VS code in Zorin OS

Time:11-25

When I run Java -version command it shows:

openjdk version "17.0.5" 2022-10-18
OpenJDK Runtime Environment Temurin-17.0.5 8 (build 17.0.5 8)
OpenJDK 64-Bit Server VM Temurin-17.0.5 8 (build 17.0.5 8, mixed mode, sharing)

Still, when I open VS code, It shows me this VS code Window error message

How to resolve this ??

I tried installing Multiple JDKs and still the error continues, I tried to look into extensions settings but can't get what to do

Also when i try to configure java runtime with command pallet it shows me this:

Vs code window with error

CodePudding user response:

Add the following configuration to the settings.json to specify the jdk path

    // Here is the Windows system as an example
    "java.configuration.runtimes": [
        {
            "name": "JavaSE-17",
            "path": "C:\\Users\\Admin\\AppData\\Local\\Programs\\Eclipse Adoptium\\jdk-17.0.3.7-hotspot",
            "default": true
        },
    ],

More information can be found here.

  • Related