Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Java 13 features in Eclipse?

Is there a way to get Eclipse to understand Java 13 features, such as text blocks? Eclipse reports errors for the following code:

class Main {
    private String text = """
            first line
            second line
            third line
            """;
}

Errors include:

first cannot be resolved to a type
Duplicate field Main.line

I suspect the problem is the combination of Eclipse and Java 13 in general.

Building with Maven succeeds (with appropriate --enable-preview config). The "installed JRE" in use is Java 13 (with --enable-preview as default VM argument). Installing Java 13 Support for Eclipse 2019-09 doesn't seem to help either (doesn't add the Java 13 compliance level option).

like image 996
ernest_k Avatar asked Jun 08 '26 04:06

ernest_k


1 Answers

You would need to set JRE13 to eclipse and also will need to select BETA 13 under settings.

Check configuration steps at https://wiki.eclipse.org/Java13/Examples

In Project > Properies: Java Compiler make sure Java 13 preview features are enabled:

enter image description here

I did follow the steps and it worked for me.

Screenshots from MacOS

enter image description here

enter image description here

like image 168
www.hybriscx.com Avatar answered Jun 10 '26 06:06

www.hybriscx.com