如何在AdoptOpenJDK 11和JavaFX 11上使用VM参数执行.Jar文件?

问题描述 投票:1回答:1

我需要在JAR文件中导出一个简短的测试应用程序,但是启动该应用程序时出现错误:

Error: A JNI error has occurred, please check youe installation and try again

A Java Exception has occurred

这是我的VM参数:

--module-path ${PATH_TO_FX} --add-modules javafx.controls,javafx.fxml,javafx.swing

--add-opens
javafx.base/com.sun.javafx.runtime=ALL-UNNAMED
--add-opens
javafx.controls/com.sun.javafx.scene.control.behavior=ALL-UNNAMED
--add-opens
javafx.controls/com.sun.javafx.scene.control=ALL-UNNAMED
--add-opens
javafx.base/com.sun.javafx.binding=ALL-UNNAMED
--add-opens
javafx.base/com.sun.javafx.event=ALL-UNNAMED
--add-opens
javafx.graphics/com.sun.javafx.stage=ALL-UNNAMED
--add-opens
javafx.graphics/com.sun.javafx.scene=ALL-UNNAMED

我需要所有这些参数,因为我使用了:

  • AdoptOpenJDK 11 Hotspot
  • JavaFX 11

没有这个虚拟机参数,我无法运行我的应用程序。

我如何导出此VM参数以在任何PC上使用我的应用程序?

java jar runtime-error executable-jar
1个回答
0
投票

您应该能够像这样运行它:

© www.soinside.com 2019 - 2024. All rights reserved.