什么是部署JavaFX应用程序,创建JAR和自包含的应用程序和本机安装的最佳途径 [英] What is the best way to deploy JavaFX application, create JAR and self-contained applications and native installers

查看:496
本文介绍了什么是部署JavaFX应用程序,创建JAR和自包含的应用程序和本机安装的最佳途径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的IntelliJ IDEA,我有我的JavaFX应用程序准备部署。
问题是,当我生成JAR文件,它不会运行,当我在命令行中运行它,我得到一个异常,FXMLLoadException,尽管这个项目是我的IDE可以正常使用。

I'm using IntelliJ IDEA, and I have my JavaFX application ready for deployment. The problem is that when I generate the JAR file, it won't run, when I run it in the command line, I get an Exception, FXMLLoadException, although the project is working perfectly in my IDE.

Ant任务结束与错误15分过后,这座建筑,我真不明白究竟是什么就是问题所在。

Ant tasks end with errors, after 15 minutes of building, I really don't understand what's the problem exactly.

所以我的问题是什么部署JavaFX应用程序的正确方法正确的步骤,任何教程或指南将受到欢迎。

So my question what are the right steps to deploy a JavaFX application the right way, any tutorial or guide will be welcome.

推荐答案

一个Java应用程序可以打包以不同的方式。请通过的Java包装概述找到关于它的一切。其中包装是一个自包含的Java应用程序

A Java application can be packaged in various ways. Please go through Java Packaging Overview to find everything about it. One of the packaging is a self-contained Java application.

有不同的方法来创建这些包:

There are different ways to create these packages :


  • 使用随附的JDK
  • javapackager 工具
  • 的JavaFX Ant任务

  • 的JavaFX Maven插件为Maven项目

独立的应用程序是一个方法你的应用程序如何被包装和特定的平台。该软件包包含:

Self-contained application is one the ways how your application can be packaged and is platform specific. The bundle contains :


  • 应用程序包

  • JRE的专用副本

可用包的列表可以是<一个href=\"https://docs.oracle.com/javase/8/docs/technotes/guides/deploy/self-contained-packaging.html#A1324980\">found这里。

让我们看看提供的各种工具,在我们的处置,以及如何使用它们:

Let us check out the various tools available at our disposal and how to use them:

JavaPackager工具

<一个href=\"https://docs.oracle.com/javase/8/docs/technotes/guides/deploy/packager.html#CCHIHIIJ\">JavaPackager工具是最基本的工具,可以帮助你进行编译,包装,标志和部署Java(FX)的应用程序,而无需编写任何额外的脚本。在 javapackager.jar 文件位于JDK安装的bin目录。

JavaPackager Tool is the most basic tool and helps you to compile, package, sign, and deploy your Java(FX) applications, without writing any additional scripts. The javapackager.jar file is located in the bin directory of the JDK installation.

命令列表,可以与它采用的是可以在这里

The list of commands, that can be used with it is available here.

的JavaFX Ant任务

<一个href=\"https://docs.oracle.com/javase/8/docs/technotes/guides/deploy/javafx_ant_tasks.html#CIACDJHC\">JavaFX Ant任务可以帮助你只是创造为您的项目的build.xml 文件打包应用程序。

JavaFX Ant Tasks helps you package your application by just creating a build.xml file for your project.

有关如何使用Ant脚本为您的项目可以<一一套例子href=\"https://docs.oracle.com/javase/8/docs/technotes/guides/deploy/javafx_ant_tasks.html#CIAEBEDD\">found这里。

A set of examples on how to use ant scripts for your project can be found here.

这可以用它用于命令列表是<一个href=\"https://docs.oracle.com/javase/8/docs/technotes/guides/deploy/javafx_ant_task_reference.html#CIAJGAFH\">available这里。

The list of commands that can be used for with it is available here.

的JavaFX Maven插件

JavaFX的Maven插件的利用包装java应用到行家平台的使用。你可以把它通过添加一个插件项目打包基于Maven的Java应用程序。

JavaFX Maven Plugin leverages the usage of packaging java application to the maven platform. You can it to package your maven based java application by adding a plugin to the project.

这个插件恕我直言,如果最简单使用了三个。这是一个非常写得很好,很容易理解的工具,拥有丰富的文档。

This plugin IMHO, if the easiest to use out of the three. It is a very nicely written, easy to understand tool and has extensive documentation.

延伸阅读:

Further Reading :

  • Native packaging for JavaFX
  • JavaFX packaging tools update

这篇关于什么是部署JavaFX应用程序,创建JAR和自包含的应用程序和本机安装的最佳途径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆