Getting invalid runtime for javaSE-16 error in vscode - runtime not compatible with the javaSE-16 environment

3.1k Views Asked by At

i recently changed my distro to arch from manjaro which comes installed with openjdk, the problem with that is i couldn't read the java developer code (like for example, I want to read how Queue is implemented - couldn't do it with openjdk for some reason), so i installed oracle jdk-16 which solved the problem - i could now ctrl + leftclick on some entity and view its implementation. But that posed a new problem, when ever i start vscode it shows me this error

Invalid runtime for JavaSE-16: Runtime at '/usr/lib/jvm/java-16-jdk' is not compatible with 
the 'JavaSE-16' environment.

I tried every other value for runtime path in the java:configure java runtime but I end up getting the same problem but with different runtime path.

I even changed my default java in my os using archlinux-java set java-16-jdk and checked it if it was set correctly using archlinux-java status and it says java-16-jdk is the default jdk.

Here, is my the relevant part of settings.json -

"java.configuration.runtimes": [
    
        {
            "name": "JavaSE-16",
            "path": "/usr/lib/jvm/java-16-jdk",
            "default": true
        }
    ],
    "java.home": "/usr/lib/jvm/java-16-jdk"

Also when i hover over the name attribute of java.configuration.runtime i get this following hint -

Value is not accepted. Valid values: "J2SE-1.5", "JavaSE-1.6", "JavaSE-1.7", "JavaSE-1.8", 
"JavaSE-9", "JavaSE-10", "JavaSE-11", "JavaSE-12", "JavaSE-13", "JavaSE-14", "JavaSE-15

I'm kinda new to java, so any help is appreciated. Thanks

1

There are 1 best solutions below

1
On

There's github issue for reporting java extension doesn't support java16, so engineers are adding support for java16. It may be achievable in next update.