JavaFX和OpenJDK [英] JavaFX and OpenJDK

查看:3013
本文介绍了JavaFX和OpenJDK的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试决定是否可以为Java应用程序的用户界面切换到JavaFX。我的大多数用户都会使用Oracle JRE,它最近集成了JavaFX。但是,有些人正在使用OpenJDK(在Linux上)。 这个(旧)问题表明OpenJDK与JavaFX的处理非常糟糕。根据这个问题,替代OpenJFX只会在版本9中完全集成到OpenJDK中。所以我的问题是双重的:

I'm trying to decide whether I could switch to JavaFX for the user interface of my Java application. Most of my users would be using the Oracle JRE, which has JavaFX integrated these days. However, some are using OpenJDK (on linux). This (old) question suggests that OpenJDK deals very badly with JavaFX. According to this question, the alternative OpenJFX will only be fully integrated into OpenJDK in version 9. So my question is twofold:


  • OpenJDK中的JavaFX支持是否仍然如此糟糕?

  • 如果是这样,是有任何已经提供OpenJFX软件包的Linux发行版,因此用户无需构建它他们自己

  • Is the JavaFX support in OpenJDK still so bad?
  • If so, are there any Linux distributions that already offer an OpenJFX package so users wouldn't have to build it themselves?

推荐答案

JavaFX是OpenJDK的一部分

JavaFX项目本身是开源并且是 OpenJDK项目的一部分

The JavaFX project itself is open source and is part of the OpenJDK project.

从OpenJDK存储库构建JavaFX

你可以建立一个完全从源代码打开OpenJDK版本(包括JavaFX),它不依赖于Oracle JDK或封闭源代码。

You can build an open version of OpenJDK (including JavaFX) completely from source which has no dependencies on the Oracle JDK or closed source code.

更新:使用从OpenJDK源预先构建的JavaFX发行版

正如对此问题的评论和另一个答案中所述,Debian Linux发行版提供了JavaFX二进制发布基于OpenJDK:

As noted in comments to this question and in another answer, the Debian Linux distributions offer a JavaFX binary distibution based upon OpenJDK:

  • https://packages.qa.debian.org/o/openjfx.html
  • Install via:

sudo apt-get install openjfx


Open JDK与Oracle JDK之间在JavaFX方面的差异

以下为Java 8提供了信息。从Java开始9, JavaFX不推荐使用VP6编码 Oracle WebStart / Browser嵌入式应用程序部署技术也已弃用。因此,未来版本的JavaFX,即使它们是由Oracle分发的,也可能不包括任何非开源技术。

The following information was provided for Java 8. As of Java 9, VP6 encoding is deprecated for JavaFX and the Oracle WebStart/Browser embedded application deployment technology is also deprecated. So future versions of JavaFX, even if they are distributed by Oracle, will likely not include any technology which is not open source.

Oracle JDK包含一些无法从OpenJDK使用的软件。有两个与JavaFX相关的主要组件。

Oracle JDK includes some software which is not usable from the OpenJDK. There are two main components which relate to JavaFX.


  1. 由谷歌和谷歌拥有的ON2 VP6视频编解码器尚未开源。

  2. Oracle WebStart / Browser嵌入式应用程序部署技术。

这意味着开放版本JavaFX无法播放VP6 FLV文件。这不是一个很大的损失,因为很难找到VP6编码器或VP6中编码的媒体。

This means that an open version of JavaFX cannot play VP6 FLV files. This is not a big loss as it is difficult to find VP6 encoders or media encoded in VP6.

其他更常见的视频格式,例如H.264,可以通过JavaFX的开放版本播放(只要您在目标上预先安装了相应的编解码器)机器人)。

Other more common video formats, such as H.264 will playback fine with an open version of JavaFX (as long as you have the appropriate codecs pre-installed on the target machine).

缺乏WebStart / Browser嵌入式部署技术实际上与OpenJDK本身有关,而不是特定于JavaFX。此技术可用于部署非JavaFX应用程序。

The lack of WebStart/Browser Embedded deployment technology is really something to do with OpenJDK itself rather than JavaFX specifically. This technology can be used to deploy non-JavaFX applications.

如果OpenSource社区开发了一种用于Java(和其他软件)的部署技术,它完全取代了WebStart和Browser Embedded部署方法,那将是一件好事。 ,应用程序分发的低影响用户体验。我相信已经有一些项目开始服务于这样一个目标,但它们还没有达到很高的成熟度和采用水平。

It would be great if the OpenSource community developed a deployment technology for Java (and other software) which completely replaced WebStart and Browser Embedded deployment methods, allowing a nice light-weight, low impact user experience for application distribution. I believe there have been some projects started to serve such a goal, but they have not yet reached a high maturity and adoption level.

我个人觉得WebStart / Browser嵌入式部署是传统技术,目前有更好的方法来部署许多JavaFX应用程序(例如自包含应用程序)。

Personally, I feel that WebStart/Browser Embedded deployments are legacy technology and there are currently better ways to deploy many JavaFX applications (such as self-contained applications).

谁需要创建包含JavaFX的Linux OpenJDK发行版

它已启动对于基于OpenJDK(例如Redhat,Ubuntu等)为Linux发行版创建包的人来说,为包含JavaFX的JDK和JRE创建RPM。那些软件分发者然后需要将生成的包放在他们的标准分发代码库中(例如fedora / red hat network yum存储库)。目前尚未完成,但如果Java 8 Linux套件在2014年3月发布Java 8时不会包含JavaFX,我会感到非常惊讶。

It is up to the people which create packages for Linux distributions based upon OpenJDK (e.g. Redhat, Ubuntu etc) to create RPMs for the JDK and JRE that include JavaFX. Those software distributors, then need to place the generated packages in their standard distribution code repositories (e.g. fedora/red hat network yum repositories). Currently this is not being done, but I would be quite surprised if Java 8 Linux packages did not include JavaFX when Java 8 is released in March 2014.

建议关于大量应用程序的部署

我建议使用Java的自包含应用程序部署模式。

I advise using Java's self-contained application deployment mode.

此部署模式的说明如下:

A description of this deployment mode is:


应用程序安装在本地驱动器上,并使用Java和JavaFX运行时的私有副本作为独立的
程序运行。
应用程序的启动方式与该操作系统的其他原生
应用程序相同,例如使用桌面
快捷方式或菜单项。

Application is installed on the local drive and runs as a standalone program using a private copy of Java and JavaFX runtimes. The application can be launched in the same way as other native applications for that operating system, for example using a desktop shortcut or menu entry.

您可以从Oracle JDK发行版或包含JavaFX的OpenJDK版本构建一个自包含的应用程序。使用Oracle JDK目前​​更容易实现。

You can build a self-contained application either from the Oracle JDK distribution or from an OpenJDK build which includes JavaFX. It currently easier to do so with an Oracle JDK.

由于Java的一个版本与您的应用程序捆绑在一起,您不必关心Java的哪个版本可能已预先安装在机器上,它具有哪些功能以及它是否与您的程序兼容。相反,您可以针对确切的Java运行时版本测试应用程序,并将其与您的应用程序一起分发。部署应用程序的用户体验与在其计算机上安装本机应用程序相同(例如,安装了Windows .exe或.msi,OS X .dmg,Linux .rpm或.deb)。

As a version of Java is bundled with your application, you don't have to care about what version of Java may have been pre-installed on the machine, what capabilities it has and whether or not it is compatible with your program. Instead, you can test your application against an exact Java runtime version, and distribute that with your application. The user experience for deploying your application will be the same as installing a native application on their machine (e.g. a windows .exe or .msi installed, an OS X .dmg, a linux .rpm or .deb).

更新,2018年4月:有关Oracle未来发展政策的信息

  • The Future of JavaFX and Other Java Client Roadmap Updates by Donald Smith, Sr. Director of Product Management, Oracle.
  • Java Client Roadmap Update - March 2018 an Oracle White Paper.

这篇关于JavaFX和OpenJDK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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