[英]Missing SwingInterOpUtils when running JavaFx in an Swing application build with Maven
I have an Swing application and I want to integrate JavaFx to it.我有一个 Swing 应用程序,我想将 JavaFx 集成到它。 The application runs well when starting from Eclipse.
从 Eclipse 启动时,应用程序运行良好。
Here is the main class:这是主要课程:
package org.openjfx.hellofx;
import java.awt.BorderLayout;
import javafx.embed.swing.JFXPanel;
import javafx.scene.Scene;
import javax.swing.JFrame;
public class AppRun {
public static void main(String[] args) {
JFrame f = new JFrame("TEST");
f.setSize(400, 400);;
f.getContentPane().setLayout(new BorderLayout());
JFXPanel panel = new JFXPanel();
Scene s = new Scene(new javafx.scene.control.Label("JavaFx"));
panel.setScene(s);
f.getContentPane().add(panel);
f.setVisible(true);
}
}
I don't know if you are creating a modular application, but I think you should consider using javafx-maven-plugin
instead of maven-shade-plugin
to generate a custom native image of your application.我不知道您是否正在创建模块化应用程序,但我认为您应该考虑使用
javafx-maven-plugin
而不是maven-shade-plugin
来生成应用程序的自定义本机映像。 You already included the plugin, just run mvn clean javafx:jlink
.您已经包含了插件,只需运行
mvn clean javafx:jlink
。 Check the plugin's GitHub README for configuration details: https://github.com/openjfx/javafx-maven-plugin检查插件的 GitHub README 以获取配置详细信息: https ://github.com/openjfx/javafx-maven-plugin
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.