【发布时间】:2020-03-24 22:32:27
【问题描述】:
我需要在JAR 文件中导出一个简短的测试应用程序,但是当我启动应用程序时出现错误:
Error: A JNI error has occurred, please check youe installation and try again
A Java Exception has occurred
这是我的虚拟机参数:
--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 HotspotJavaFX 11
如果没有这个 vm 参数,我将无法运行我的应用程序。
如何导出此 VM 参数以在任何 PC 上使用我的应用程序?
【问题讨论】:
-
您遇到的错误似乎与
JNI相关。可以分享Exception的内容吗?可能缺少一些原生库?
标签: java jar runtime-error executable-jar