skip to Main Content

I’m using vscode on my windows 11 using jdk 21, but when my prof ask us to install netbeans version 8, i have a hard time in installing because it says that may jdk 21 is not compatible with netbeans 8, then may prof make me download jdk 8 and jre 8, now that the netbeans version 8 is running in may laptop. My vscode Don’t run anymore. How can i change the default jdk in vscode because jdk 21 is still installed in my laptop, but vscode can’t recognize itenter image description here

Can you give me some advice on how to fix it, than you

2

Answers


  1. The error message has nothing to do with Visual Studio Code, it is from the Java runtime. It would appear that your profile has links to both versions of Java, which is causing incompatibilities between the compiler and the run time. The quickest way to resolve this would be to remove all versions of Java from your system. Then re-install version 8 and rebuild all your projects.

    Login or Signup to reply.
  2. You can use this setting to configure java17 or higher to activate the Java language server.

        // Specifies the folder path to the JDK (17 or more recent) used to launch the Java Language Server. This setting will replace the Java extension's embedded JRE to start the Java Language Server.
        // On Windows, backslashes must be escaped, i.e.
        // "java.jdt.ls.java.home":"C:\Program Files\Java\jdk-17.0_3"
    
        "java.jdt.ls.java.home": "E:\Program Files\Java\jdk-17.0.5",
    

    You can then configure the version of java used by the java extension using the settings below.

        // Map Java Execution Environments to local JDKs.
    
        "java.configuration.runtimes": [
            {
                "name": "JavaSE-1.8",
                "path": "E:\Program Files\Java\jdk1.8.0_341",
            },
            {
                "name": "JavaSE-17",
                "path": "E:\Program Files\Java\jdk-17.0.5",
                "default": true,
            }
        ],
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search