Java 14 preview seems not to be working properly
See original GitHub issueHello,
I just set up a project and I need to try textblock. I wrote the following pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.kearny</groupId>
<artifactId>rope</artifactId>
<version>1.0-SNAPSHOT</version>
<name>RopeTextEditor</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>14</maven.compiler.source>
<maven.compiler.target>14</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>14.0.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.4</version>
<configuration>
<source>14</source>
<target>14</target>
<release>14</release>
<mainClass>com.kearny.rope.RopeTextEditor</mainClass>
<commandlineArgs>--enable-preview</commandlineArgs>
</configuration>
</plugin>
</plugins>
</build>
</project>
With the following java class only:
package com.kearny.rope;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
public class RopeTextEditor extends Application {
@Override
public void start(Stage stage) throws Exception {
var javaVersion = System.getProperty("java.version");
var javafxVersion = System.getProperty("javafx.version");
var label = new Label("Hello, JavaFX " + javafxVersion + ", running on Java " + javaVersion + ".");
var scene = new Scene(new StackPane(label), 640, 480);
stage.setScene(scene);
stage.show();
Object test = """
<html>
<body>
<p>Hello, world</p>
</body>
</html>
""";
if (test instanceof String) {
System.out.println(test);
} else {
System.out.println(test);
}
}
public static void main(String[] args) {
launch(args);
}
}
I get this error: Error:(20,23) java: text blocks are a preview feature and are disabled by default.
Is there something wrong with my configuration ?
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
JDK 14 + preview-features not working correctly #1167 - GitHub
Hello, our project uses maven with eclipse 4.16 and 4.17, latest greclipse release (also same on snapshot) java 14, groovy 3 and joint...
Read more >"Records" preview feature in IntelliJ 2020.1 with Java 14 fails ...
"Records" preview feature in IntelliJ 2020.1 with Java 14 fails with compiler error during Maven `install`, but runs otherwise - Stack Overflow ...
Read more >The role of preview features in Java 14, Java 15, Java 16, and ...
Preview features are specific to a given Java SE feature release and require the use of special flags at compile time as well...
Read more >Java 14 and IntelliJ IDEA - The JetBrains Blog
Configure IntelliJ IDEA 2020.1 to use JDK 14 for Project SDK and choose the Project language level as '14 (Preview) – Records, patterns,...
Read more >Evolving Java With ––enable–preview aka Preview Language ...
▚Eclipse. Open the Project Properties and go to Java Compiler. The panel on the right-hand side has a checkbox Enable preview features.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
How I see, I was doing either one or the other. Not both (runtime and compile time). Thx for the help.
This work for me.