user16436946
user16436946

Reputation: 129

Eclipse not recognising Java-17

Hi today I installed java 17 and eclipse(with latest version- 2021‑09). But after all configuration it is showing JavaSE-16 as jdk version. I ignored it and started writing a program with sealed classes. Then it is showing an error. I managed to solve the problem by installing the Java-17 support plugin from eclipse marketplace. Is it possible in eclipse without installing anything.

Upvotes: 10

Views: 30808

Answers (3)

VonC
VonC

Reputation: 1327584

The support should be official with Eclipse 4.22 (Q4 2021)

Java 17

Java 17 is out and Eclipse JDT supports Java 17 in 4.22.

The release notably includes the following Java 17 features:

  • JEP 306: Restore Always-Strict Floating-Point Semantics.
  • JEP 406: Pattern Matching for switch (Preview).
  • JEP 409: Sealed Classes (Final).

Please note that preview option should be on for preview language features.
For an informal introduction of the support, please refer to Java 17 Examples wiki.

Upvotes: 2

scardon
scardon

Reputation: 754

Install java 17 plugin from this link. Then your likely to have a content assist error. Fix it by this answer.

Upvotes: 2

Marged
Marged

Reputation: 10963

The release notes state this:

Supports Java 17, including Pattern Matching for Switch (Preview), Sealed Classes, and more via Eclipse Marketplace

That means currently you have to install the plugin, later support will be included. You might also want to read this: https://www.eclipse.org/eclipse/news/4.21/jdt.php

Upvotes: 6

Related Questions