在Ubuntu 20上安装openJDK + openJFX 8
我正在尝试在Ubuntu 20.10上安装OpenJDK 8和OpenJFX 8.
I'm trying to install OpenJDK 8 and OpenJFX 8 on Ubuntu 20.10.
在Ubuntu上安装openJFX 8总是有些棘手,但我以前可以使用以下SO解答中的技巧来做到这一点:
Installing openJFX 8 has always been a little tricky on Ubuntu, but I used to be able to do it using the tip from this SO answer: https://stackoverflow.com/a/56166582/2423283 That used to work fine (I think I was using Ubuntu 19.something), however it appears that recently 8u161-b12-1ubuntu2
was removed.
有关更多背景信息,我正在通过docker文件在自动化管道中进行安装.这是Dockerfile的相关部分:
For some more background information, I'm installing this via a docker file in an automated pipeline. Here are the relevant parts of the Dockerfile:
FROM my.company.internal.registry:443/ubuntu:latest
RUN apt -y update && \
apt -y install \
openjdk-8-jdk \
openjfx=8u161-b12-1ubuntu2 \
libopenjfx-java=8u161-b12-1ubuntu2 \
libopenjfx-jni=8u161-b12-1ubuntu2
这曾经运行得很好,但现在我得到了:
This used to run just fine, but now I get:
E: Version '8u161-b12-1ubuntu2' for 'openjfx' was not found
E: Version '8u161-b12-1ubuntu2' for 'libopenjfx-java' was not found
E: Version '8u161-b12-1ubuntu2' for 'libopenjfx-jni' was not found
到目前为止我已经尝试过的
我尝试在Dockerfile的FROM
行中将ubuntu:latest
更改为ubuntu:19:10
,但是仍然遇到缺少软件包的错误.
What I've tried so far
I've tried changing my ubuntu:latest
to ubuntu:19:10
in my FROM
line in the Dockerfile, but I still got the missing packages errors.
我尝试仅删除那些版本限制(=8u161-b12-1ubuntu2
),但在安装过程中没有看到任何错误,但是当我编译代码时,找不到JavaFX类.
I tried just removing those version restrictions (the =8u161-b12-1ubuntu2
) and I didn't see any errors during the installation, but then when I compiled my code, none of the JavaFX classes could be found.
如果您设置使用JDK 8和JavaFX,我发现最好安装一个包含JavaFX的OpenJDK.
If you are set on using JDK 8 and JavaFX, I've found it's best to install an OpenJDK that includes JavaFX.
对于版本8,并非所有OpenJDK都包含JavaFX(例如AdoptOpenJDK).我发现的最好的是
For version 8, not all OpenJDKs include JavaFX (e.g. AdoptOpenJDK). The best ones I have found are
- Zulu : You must select "JDK FX" in the Java Package drop down
- Liberica: You must select "Full JDK"
Liberica为树莓派和多种其他体系结构提供构建.如果您需要,Liberica是您的理想之选.
Liberica provides builds for raspberry pi and a wide variety of other architectures. If you need that, Liberica is the way to go.