Java test preview features
In 2 minutes
Every new Java release contains few new features in preview. This allows the community to test / review / comment them.
These features are not 'production ready' and they could disappear or change in the following releases.
Here you can find a nice explanation from Oracle: The role of preview features in Java 14, Java 15, Java 16, and beyond
How to use the preview features
JShell should contain all the new preview features without lag.
To test them you can simply add
--enable-preview to the
Here a quick tutorial:
To run code that includes preview features you should compile your source using the flags
javac --enable-preview --release [release nr.] [source].java
and execute it using
java --enable-preview [mainclass].
In IntelliJ you can configure the JDK used for the project:
Project Structure ...
Be sure that Project language level is set on [version] (Preview)
You cannot use the preview features in the JShell Console ... included in IntelliJ. This console is very limited.