Setting Up VS Code with Java JDK 21


The Java JDK 21 (Final Release Candidate) can be setup downloaded and installed on your computer by following the article.

Once the installation is done, you need to set this as the JAVA_HOME.

Finally we are all set to use JDK 21 with VS Code.

public class Hello {

    public static void main(String... args) {
        System.out.println("Hello JDK 21!");
    }
}
Macbook % java -version
openjdk 21 2023-09-19
OpenJDK Runtime Environment (build 21+35-2513)
OpenJDK 64-Bit Server VM (build 21+35-2513, mixed mode, sharing)
Macbook % /us/bin/env/Users/code2care/Downloads/jdk-21. jdk/Contents/Home/bin/java -XX:
+ShowCodeDetailsInExceptionMessages -cp /private/var/folders/5k/80h7br711xqctwe_33dv9z2w0
000gn/T/vscodesws_91146/jdt_ws/jdt.ls-java-project/bin Hello
Hello JDK 21!
Hello JDK 21 Example with VS Code

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail: rakesh@code2care.org

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap