How to add JDK 21 support in Eclipse or STS Core Java eclipse IDE java Java 21 by devs5003 - January 15, 2025January 20, 20250 Last Updated on January 20th, 2025Eclipse not recognizing Java-21, How to add JDK 21 support in Eclipse 2023-09?, How to add JDK 21 support in Eclipse or STS, jdk21 IDE , jdk21 eclipse, eclipse jdk21, eclipse java 21, java 21 eclipse, eclipse java 21 support, eclipse for java 21, JDK 21 support in Eclipse 2023-09 – java, add java 21 to eclipse, how to add java 21 to eclipse, eclipse openjdk 21, eclipse java 21 plugin, eclipse support java 21, jdk 21 eclipse, eclipse compiler compliance level 21 not available, sts java 21, add jdk 21 to eclipse, how to add jdk 21 in eclipse Oracle has released JDK 21 in September, 2023 as an LTS version after the release of JDK 20 in March, 2023. With the release of Java 21, developers can now explore the latest features, such as Record Patterns, Pattern Matching for switch, and Unnamed Classes, among others. However, to take full advantage of these features, your Eclipse IDE must be configured to support Java 21. In this article, we’ll walk through the steps to add Java 21 support in Eclipse. This includes downloading the appropriate JDK, setting up Eclipse preferences, and enabling preview features where applicable. We will learn ‘How to add JDK 21 support in Eclipse or STS. Prior to the JDK 21, JDK 17 was a Long Term Support (LTS) release, with several years of support. In this article, we will explore how to configure JDK 21 in our eclipse. We will have step by step instructions to do it easily. Let’s start our topic ‘How to add JDK 21 support in Eclipse or STS?’. Table of Contents Toggle Pre-requisiteWhere can we download Java JDK latest version from?How to install Java/JDK 21?Why to use Eclipse 2023-09?How to install Eclipse? Steps: How to add JDK 21 support in Eclipse or STS (eclipse jdk 21|eclipse java 21| sts java 21)Using Install New SoftwareHow to Verify that Eclipse/STS has Java 21 Support in place?How to Enable Preview Features of Java 21?How to test JDK 21 features in Eclipse/STS?Eclipse not recognizing Java-21 Pre-requisite Before knowing ‘How to add JDK 21 support in Eclipse or STS?’, we need to be sure that the following software are installed in our system. ♦ JDK 21 (you can download JDK 21 or download from OpenJDK archive) ♦ Eclipse 2023-09 for Eclipse users: Eclipse IDE for Enterprise Java and Web Developers (You can download Eclipse 2023-09 for Enterprise Java and Web Developers from the link as per your operating system). ♦ If you are a STS (Spring Tool Suite) user, you don’t need to download or install any specific version of STS. However, it is recommended that you should have STS 4 (Spring Tool Suite 4) installed on your system. In our case it is STS 4 – Version: 4.21.0.RELEASE. Where can we download Java JDK latest version from? There is an official website to download latest version of JDK. Even we can get the early access of future JDK versions as well from the link. Since we are discussing about JDK 21 in this article, we need to download JDK 21 first. The direct link to download JDK 21 is https://jdk.java.net/21/. How to install Java/JDK 21? In order to install JDK 21, you need to download the zip file by clicking the JDK 21 download link according to your operating system. However, you can visit the oracle site and search for the latest build of JDK 21 to get it installed. Then, you need to unzip the zip file and paste the ‘jdk-21’ folder in the directory where other jdk versions exist. However, in my case, it is ‘C:\Program Files\Java’ which is the native place of jdk installation in majority of cases. Why to use Eclipse 2023-09? Eclipse community recommends to have Eclipse 2023-09 in your system to utilize the features of Java 21. If you download Eclipse 2023-09, you will get the inbuilt feature till JDK 20. Furthermore, you just need to download and install a plugin to get the additional feature of JDK 21. On the other hand, if you already have lower versions of Eclipse in your system, then also you may download & install the specific plugin to get & utilize the features of JDK 21. How to install Eclipse? Eclipse community also recommends that we should have a specific version of Eclipse installed in our system in order to get the support of JDK 21. The specific version is Eclipse 2023-09. You can directly click on the link ‘Eclipse 2023-09 for Java EE developers‘ to get it. Once you click on the link you will be on the Eclipse download page, then you have to click on the download link appearing on the page or follow the updated steps mentioned there. Steps: How to add JDK 21 support in Eclipse or STS (eclipse jdk 21|eclipse java 21| sts java 21) In order to add JDK 21 support in your eclipse or STS, follow the below steps carefully. We also have included some images to have a clear understanding of the whole process. Using Install New Software Let’s follow below steps for the first method ‘Using Install New Software’. 1) If you are a Eclipse user, make sure you already installed JDK 21 and Eclipse 2023-09 on your system. If not, kindly visit a section given above for the guidelines in this article. 2) Open your eclipse/STS, click on Help-> Install New Software 3) In the first field (Work with) paste the below URL and hit Enter. https://download.eclipse.org/eclipse/updates/4.29-P-builds/ 4) Multiple values with checkboxes will appear. You have to select ‘Eclipse Java 21 support for 2023-09 development stream’ and then click on ‘Next’ button. A new window will appear Which may ask you to ‘accept the terms and License agreement’. Once accepted, it will start downloading the artifacts. Click on ‘Finish’ to complete the process. 5) At the end, restart the eclipse. You may also be asked to restart the eclipse to get the new features. 6) Then you need to create one Test Project to check the JDK 21 support. 7) Now click on Project -> Properties. Then select ‘Project Facets’ from the left. 8) Click on ‘Java’ checkbox and then select ’21’ from the drop-down and then click on ‘Apply and Close’ button. How to Verify that Eclipse/STS has Java 21 Support in place? 1) Click on Project -> Properties. Then select ‘Java Compiler’ from the left. 2) Uncheck the second checkbox (Use Compliance from execution environment…) 3) Now click on the drop down there on the right side. You will see an additional entry for JDK 21, which is ’21’. 4) Select ’21’ and click on ‘Apply and close’. ♥ Finally, you are ready to develop a project in Eclipse using Java 21. How to Enable Preview Features of Java 21? Java 21 includes several preview features, such as Unnamed Classes and Instance Main Methods (JEP-445), Unnamed Patterns and Variables (JEP-443). Here are the steps to Enable Preview Features: Open Project Properties: Right-click on the project in the Project Explorer and select ‘Properties’. Enable Preview: Go to Java Compiler. Check Enable preview features. Apply Settings: Click Apply and Close. How to test JDK 21 features in Eclipse/STS? 1) Create a new Java Test Project in Eclipse. 2) Right click on the project and navigate to Build Path -> Configure Build Path 3) Then, click on libraries 4) Now, add libraries from the right 5) Set the installation path for JDK 21 6) Finally, enjoy the testing of JDK 21 features. You may also go through How to configure JDK in Eclipse or STS, if face any issue in project configuration. That’s all about configuring & testing eclipse java 21| eclipse jdk 21 | eclipse java 21 support environment in your system. Eclipse not recognizing Java-21 If your eclipse is unable to recognize the Java 21 version, you need to follow above steps of this article. For previous jdk versions, kindly visit respective link as given below: ♥ link for Java19: How to enable JDK 19 support in Eclipse?‘ â™ Here is the link to get to know ‘How to enable JDK 18 support in Eclipse?‘ â™ Here is the link to get to know ‘How to enable JDK 17 support in Eclipse?‘ ♥ Also, Here is the link to get to know ‘How to enable JDK 16 support in Eclipse?‘ ♥ And here is the link to get to know ‘How to enable JDK 15 support in Eclipse?‘ Related