java -version
openjdk version "1.8.0_242"
OpenJDK Runtime Environment (build 1.8.0_242-8u242-b08-0ubuntu3~19.10-b08)
OpenJDK 64-Bit Server VM (build 25.242-b08, mixed mode)
但是,openjfx软件包:
sudo apt list openjfx
Listing... Gotowe
openjfx/eoan,now 11.0.2+1-1 amd64 [installed]
openjfx/eoan 11.0.2+1-1 i386
似乎是用Java 10编译的,因为我无法运行任何JavaFX应用程序:
Error:(3, 26) java: cannot access javafx.application.Application
bad class file: /usr/share/openjfx/lib/javafx.graphics.jar!/javafx/application/Application.class
class file has wrong version 54.0, should be 52.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
是否有任何模式使其起作用?
最佳答案
JavaFX / OpenJFX最近不是OpenJDK的一部分,因此您可以单独安装它,也可以将OpenJDK构建与预打包的OpenJFX一起使用。
关于java - Ubuntu 19.10-如何使用Java 8安装JavaFX,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/60089681/