将 javaFX (.jar) 文件导入 Netbeans Maven 项目
Importing javaFX (.jar) files into a Netbeans Maven Project
我正在尝试将 javafx (.jar) 文件导入到 Maven 项目中。我用 Netbeans 做了一个项目(Java with Ant -> Java Application)并想在 Netbeans 中使用相同的代码(Java with Maven -> Java Application) .使用 Ant,我可以轻松导入和使用 (.jar) 文件,但这似乎是 Maven 的一个受阻功能。
有什么解决办法吗?
我已经在网上查找了一些帖子和指南,但没有成功。
注意:在 maven 中实现 .jar 文件已经解决。虽然代码不起作用。
当前错误:"Exception running application com.mycompany.ep_game_ref.Game Command execution failed."
package com.mycompany.ep_game_ref;
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.image.Image;
import javafx.stage.Stage;
public class Game extends Application
{
public static String[] args;
public static Stage primarystage;
public static ObservableList<Items.Item> items = FXCollections.observableArrayList();
public static MainCentral startGame = new MainCentral();
public static Room.Introduction intro = new Room.Introduction();
public static Settings.Difficulty SETTINGS = new Settings.Difficulty();
public static Player player = new Player();
@Override
public void start(Stage stage)
{
this.primarystage = stage;
this.primarystage.setScene(new Scenes.Welcome().setWelcomeScene());
this.primarystage.getIcons().add(new Image("images/aq_logo.png"));
this.primarystage.setResizable(false);
this.primarystage.show();
}
public static void main(String[] args) {
Application.launch();
}
}
您可以通过不同的方式使用 JavaFX:
文件>新建项目>Maven>JavaFX 应用程序。
我正在尝试将 javafx (.jar) 文件导入到 Maven 项目中。我用 Netbeans 做了一个项目(Java with Ant -> Java Application)并想在 Netbeans 中使用相同的代码(Java with Maven -> Java Application) .使用 Ant,我可以轻松导入和使用 (.jar) 文件,但这似乎是 Maven 的一个受阻功能。
有什么解决办法吗?
我已经在网上查找了一些帖子和指南,但没有成功。
注意:在 maven 中实现 .jar 文件已经解决。虽然代码不起作用。
当前错误:"Exception running application com.mycompany.ep_game_ref.Game Command execution failed."
package com.mycompany.ep_game_ref;
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.image.Image;
import javafx.stage.Stage;
public class Game extends Application
{
public static String[] args;
public static Stage primarystage;
public static ObservableList<Items.Item> items = FXCollections.observableArrayList();
public static MainCentral startGame = new MainCentral();
public static Room.Introduction intro = new Room.Introduction();
public static Settings.Difficulty SETTINGS = new Settings.Difficulty();
public static Player player = new Player();
@Override
public void start(Stage stage)
{
this.primarystage = stage;
this.primarystage.setScene(new Scenes.Welcome().setWelcomeScene());
this.primarystage.getIcons().add(new Image("images/aq_logo.png"));
this.primarystage.setResizable(false);
this.primarystage.show();
}
public static void main(String[] args) {
Application.launch();
}
}
您可以通过不同的方式使用 JavaFX: 文件>新建项目>Maven>JavaFX 应用程序。