Reputation: 1813
I use this plugin in my javafx project: https://github.com/openjfx/javafx-maven-plugin ,
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.4</version>
<configuration>
...
<launcher>launcher</launcher>
<mainClass>xxx/com.xxx.Main</mainClass>
</configuration>
</plugin>
I use java 14 preview features in my code, and use javafx:jlink
command to generate Runtime image, but when I run Runtime image, error:
java.lang.UnsupportedClassVersionError: Preview features are not enabled for com/xxx/Main (class file version 58.65535). Try running with '--enable-preview'
.
how to config --enable-preview
when using javafx:jlink in javafx-maven-plugin
Upvotes: 1
Views: 458
Reputation: 294
Change your javafx-maven-plugin's configuration
<configuration>
...
<launcher>launcher</launcher>
<mainClass>xxx/com.xxx.Main</mainClass>
<options>
<option>--enable-preview</option>
</options>
</configuration>
Note : Options are also added to jlink image script
Upvotes: 2