Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 18:12 Go to next message
Vivien Born is currently offline Vivien BornFriend
Messages: 1
Registered: November 2023
Junior Member
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 07:56 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33180
Registered: July 2009
Senior Member
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


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Java 21 features wont work [message #1862991 is a reply to message #1862361] Wed, 10 January 2024 09:50 Go to previous message
Jarred Lebsack is currently offline Jarred LebsackFriend
Messages: 2
Registered: December 2023
Junior Member
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: Tue Jul 16 16:57:22 GMT 2024

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

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

Back to the top