Issue
I have created a Java Maven project with Java version 14 in Netbeans. I have already instructed the compiler to enable preview features, and that works.
Now I have a bunch of classes containing main methods, and I want to execute one of them using right-click on file » Run File
. But I get a java.lang.UnsupportedClassVersionError
saying that "Preview features are not enabled". How can I execute the Run File action with preview features enabled?
Solution
This can be configured within the project properties.
- Right-click on the project and select Properties.
- Select Actions in the left menu.
- A list of actions is presented. Select Run file via main().
- Edit the
exec.args
property by adding--enable-preview
immediately behind the equals sign.
Answered By - MC Emperor