4.0.0 tech.zger Demo1.0-SNAPSHOT jar com.jfoenix jfoenix8.0.10 maven-compiler-plugin 3.8.1 1.8 UTF-8 org.apache.maven.plugins maven-resources-plugin3.2.0 true UTF-8 org.apache.maven.plugins maven-jar-plugin3.0.2 false true lib/ tech.zger.javafx.MainApplication ./ org.apache.maven.plugins maven-dependency-plugin3.2.0 copy-dependencies package copy-dependencies jar jar ${project.build.directory}/lib
2. 测试主类及fxml
MainApplication
package tech.zger.javafx; import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; import java.io.IOException; public class MainApplication extends Application { public static void main(String[] args) { launch(args); } @Override public void start(Stage primaryStage){ try { Parent root = FXMLLoader.load(getClass().getResource("/view/main.fxml")); Scene scene = new Scene(root, 600, 400); primaryStage.setScene(scene); primaryStage.setTitle("JavaFX Maven打包测试"); primaryStage.show(); } catch (IOException e) { e.printStackTrace(); } } }
main.fxml
3. 打包
打包成功后可以看到lib目录
运行Demo-1.0-SNAPSHOT.jar
至此JavaFX 的打包成功!!!
MANIFEST.MF
Manifest-Version: 1.0 Built-By: Administrator Class-Path: lib/jfoenix-8.0.10.jar ./ Created-By: Apache Maven 3.8.2 Build-Jdk: 1.8.0_301 Main-Class: tech.zger.javafx.MainApplication
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)