[Java] Programming from the age of 51 (currently 52) Reminder VS code java.awt javax.swing // Java 11 or more recent is required to run

1 minute read

I was reviewing java with VScode When I try to check the behavior of JFrame

VScode ``vs code Java 11 or more recent is required to run…’’

I’m

Import java.awt javax.swing with #VScode In my case, the jdk used in eclipse is ver8, so I assume that VScode should be ver8.

  1. Specify the path of jdk 8 in the environment setting on windows side (omitted)
  2. Specify 2 items in settings.json on VScode side
  3. Version change of Language Suport for java on VScode side

Will come

Is this error fixed when the JDK is updated in September 2020 and when VScode supports it? So this article is a limited article so far.

2.setting.json

Specifying jdk in java.home Specify jdk in java.configuration.runtimes

    "java.home": "C:\\Program Files\\AdoptOpenJDK\\jdk-8.0.262.10-openj9",
    "java.configuration.runtimes": [
        {
          "default":true,
          "name": "JavaSE-1.8",
          "path": "C:\\Program Files\\AdoptOpenJDK\\jdk-8.0.262.10-openj9",
        },
    ],

3.Language Supprt for java

I don’t know why, but if I don’t downgrade the version of this extension, I get an error. If it corresponds to intelisense (code completion function), it means that it is ver 0.57 or more, so I lowered it there.

Error factor

One of the causes is an error because there is a compatibility problem between the API (awt/swing) of JDK11 and windows. To improve this, wait until the jdk update in September 2020, or it will be supported by an older version such as jdk8, but as a second factor, VScode specifications require JDK 11.

It seems that VScode is eclipse compliant and eclipse recommends the latest jdk, but VScode seems to strongly demand such a place. Therefore, if the jdk specified on VScode side is different from the recommended version, it seems to be a specification that causes a runtime error. To avoid this, specify the java execution configuration. I don’t know the reason for lowering the version of VScode extension (LanguageSupportForJava), but maybe the jdk that corresponds to each version is different.