我在javafx项目中使用了这个插件: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>
我在代码中使用java 14预览功能,并使用javafx:jlink
命令生成运行时图像,但是当我运行运行时图像时,出错:
java.lang.UnsupportedClassVersionError: Preview features are not enabled for com/xxx/Main (class file version 58.65535). Try running with '--enable-preview'
。
在javafx-maven-plugin中使用javafx:jlink时如何配置--enable-preview
发布于 2020-10-20 22:44:40
更改javafx-maven-plugin的配置
<configuration>
...
<launcher>launcher</launcher>
<mainClass>xxx/com.xxx.Main</mainClass>
<options>
<option>--enable-preview</option>
</options>
</configuration>
注意:选项也添加到jlink图像脚本中。
https://stackoverflow.com/questions/61090444
复制相似问题