Reputation: 45319
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).
Upvotes: 2
Views: 1771
Reputation: 309
Perhaps because I am using Cucumber for Eclipse, in addition to the steps given by @www.hybriscx.com, I had to make jdk-13 my selected JRE.
Then I had to Edit that JDK-13 Installation to include the --enable-preview
argument.
I also set the Execution Environments page to set JavaSE-13 to use the jdk-13 JRE.
Upvotes: 2
Reputation: 1129
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:
I did follow the steps and it worked for me.
Screenshots from MacOS
Upvotes: 8