openjdk怎么执行java命令,如何在Ubuntu 18.04.2 LTS上使Java FX与OpenJDK 8一起运行?

When trying to compile an JavaFX application in the environment:

java -version

openjdk version "1.8.0_212"

OpenJDK Runtime Environment (build 1.8.0_212-8u212-b03-0ubuntu1.18.04.1-b03)

OpenJDK 64-Bit Server VM (build 25.212-b03, mixed mode)

cat /etc/lsb-release

DISTRIB_ID=Ubuntu

DISTRIB_RELEASE=18.04

DISTRIB_CODENAME=bionic

DISTRIB_DESCRIPTION="Ubuntu 18.04.2 LTS"

I get the error-message:

cannot access javafx.event.EventHandler

[ERROR] class file for javafx.event.EventHandler not found

I tried to find a solution by following these links:

The most promising actions where to

install openjfx with apt install openjfx

set the JAVA_HOME environment variable to /usr/lib/jvm/java-8-openjdk-amd64

But the error persists.

What needs to be done to get OpenJDK 8 and JavaFX working on Ubuntu 18.04.2 LTS?

解决方案

The hint from

helped. The commands:

apt purge openjfx

apt install openjfx=8u161-b12-1ubuntu2 libopenjfx-jni=8u161-b12-1ubuntu2 libopenjfx-java=8u161-b12-1ubuntu2

apt-mark hold openjfx libopenjfx-jni libopenjfx-java

fixed the problem. Many thanks to https://github.com/Druidefix for this. (If you'd like to answer this yourself I'll happily delete my own answer ...)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值