Home > Enterprise >  VSCode can't change Java Version in "Configure Java Runtime"
VSCode can't change Java Version in "Configure Java Runtime"

Time:10-24

Im trying to configure a Java Web project in VSCode and want to use Java 8 for a project.

Configure Java Classpath Window

The value "Java Version" is set to 19 and i can select other versions but it wont ever get saved. If i press CTRL S or press the pen button next to the selection, nothing happens. If i come back to this screen after changing it its back to version 19 (which i dont want).

Is there another way to change this setting or am i doing something wrong?

I installed the Java Extensions Pack already.

CodePudding user response:

If you follow this link you should find some helpful information. VSC supports Java versions 1.5 and above

If I could give my two cents however, there are many IDEs that are much more intuitive and have built-in Java support where VSC does not. IDEs like IntelliJ or Eclipse are your best options for debugging, maven, library support, etc. (IntelliJ is my personal favourite).

CodePudding user response:

First of all, you have to make sure that the corresponding version of jdk is installed on your machine. and then select it in the Configure Java Runtime interface. It can also be configured in the settings.json file.

    "java.configuration.runtimes": [
        {
            "name": "JavaSE-16",
            "path": "C:\\Program Files\\Java\\jdk-16.0.2"
        },
        {
            "name": "JavaSE-17",
            "path": "C:\\Users\\Admin\\AppData\\Local\\Programs\\Eclipse Adoptium\\jdk-17.0.3.7-hotspot"
        },
        {
            "name": "JavaSE-18",
            "path": "C:\\Program Files\\Java\\jdk-18.0.1.1",
            "default": true
        }
    ]

It should be noted that if your project uses a build tool, then you need to modify the Java version in the corresponding configuration file.

  • Related