Skip to main content



      Home
Home » Newcomers » Newcomers » Java 21 features wont work(I installed Java 21 and told Eclipse to use the jdk 21 folder but the new Java 21 Features still wont work.)
Java 21 features wont work [message #1862361] Tue, 28 November 2023 13:12 Go to next message
Eclipse UserFriend
Hey!
I am rather new to Ecplipse and tried installing jdk 21 (from the oracle website) and created a new Java project in eclipse. As for the JRE I referenced the folder of the newly installed jdk21. Now I wanted to try out the new "switch" with using Typepatterns but Ecplipse gives me the error, that I only can use int, string,.. for a switch command. But well, in Java 21 it should be possible to also use objects.

If I print
System.out.println(System.getProperty("java.version"));
I get "21.0.1"

Therefor I now dont know what to try to fix that issue.
Does someone have an idea on how to handle that?
Re: Java 21 features wont work [message #1862365 is a reply to message #1862361] Wed, 29 November 2023 02:56 Go to previous messageGo to next message
Eclipse UserFriend
The 2023-09 release did not include support for Java 21 features. The next release is almost final so you'd probably be best to install that:

https://www.eclipse.org/downloads/packages/release/2023-12/rc1
Re: Java 21 features wont work [message #1862991 is a reply to message #1862361] Wed, 10 January 2024 04:50 Go to previous message
Eclipse UserFriend
Vivien Born wrote on Tue, 28 November 2023 18:12
Hey!
I am rather new to Ecplipse and tried installing jdk 21 (from the oracle website) and created a new Java project in eclipse. As for the JRE I referenced the folder of the newly installed jdk21. Now I wanted to try out the new "switch" with using Typepatterns but Ecplipse gives me the error, that I only can use int, string,.. for a switch command. But well, in Java 21 it should be possible to also use objects.tunnel rush

If I print
System.out.println(System.getProperty("java.version"));
I get "21.0.1"

Therefor I now dont know what to try to fix that issue.
Does someone have an idea on how to handle that?


The Pattern Matching for switch feature allows you to use pattern patterns in switch statements, which can match the type of an object. To use this feature in Eclipse, you need to ensure that you are using Java 21 as your compliance level compiler. After changing the compiler compliance level, you will be able to use the new conversion feature in your code.

If you are still having problems, I recommend checking that your JDK installation is configured correctly and that you have the latest version of Eclipse installed.
Previous Topic:No repository found when install plugin
Next Topic:Eclipse not launching after initial launch
Goto Forum:
  


Current Time: Wed Mar 19 00:09:09 EDT 2025

Powered by FUDForum. Page generated in 0.06160 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top