如何在Ubuntu 18.04.2 LTS上使Java FX与OpenJDK 8一起运行? [英] How do I get Java FX running with OpenJDK 8 on Ubuntu 18.04.2 LTS?
本文介绍了如何在Ubuntu 18.04.2 LTS上使Java FX与OpenJDK 8一起运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在环境中尝试编译JavaFX应用程序时:
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"
我收到错误消息:
cannot access javafx.event.EventHandler
[ERROR] class file for javafx.event.EventHandler not found
我试图通过以下链接找到解决方案:
I tried to find a solution by following these links:
- 如何在Maven中添加Javafx依赖项使用Java 10
- https://mvnrepository.com/artifact/org.openjfx/javafx/11
- 带有JavaFX的Maven项目(lib中的jar文件`)
- https://github.com/javafx-maven-plugin/javafx- Maven插件
- https://askubuntu.com/questions/1091157/javafx-missing-ubuntu-18 -04
- https://unix.stackexchange.com/questions/505628/add-openjfx-class-path-in-debian-for-java11
- https://askubuntu.com/questions/609951/javafx-is-not-on-the-default-classpath-even-with-oracle-jdk-1-8
- http://can4eve.bitplan.com/index.php/JavaFX
- how to add javafx dependencies in maven with java 10
- https://mvnrepository.com/artifact/org.openjfx/javafx/11
- Maven project with JavaFX (with jar file in `lib`)
- https://github.com/javafx-maven-plugin/javafx-maven-plugin
- https://askubuntu.com/questions/1091157/javafx-missing-ubuntu-18-04
- https://unix.stackexchange.com/questions/505628/add-openjfx-class-path-in-debian-for-java11
- https://askubuntu.com/questions/609951/javafx-is-not-on-the-default-classpath-even-with-oracle-jdk-1-8
- Why is JavaFX is not included in OpenJDK 8 on Ubuntu Wily (15.10)?
- http://can4eve.bitplan.com/index.php/JavaFX
最有前途的行动
- 使用apt安装openjfx来安装openjfx
- 将JAVA_HOME环境变量设置为/usr/lib/jvm/java-8-openjdk-amd64
但是错误仍然存在.
But the error persists.
要使OpenJDK 8和JavaFX在Ubuntu 18.04.2 LTS上运行需要做什么?
推荐答案
来自
https://github.com/JabRef/help.jabref.org/Issues/204
有帮助.命令:
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
解决了该问题.非常感谢 https://github.com/Druidefix . (如果您想自己回答,我会很乐意删除我自己的答案...)
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 ...)
这篇关于如何在Ubuntu 18.04.2 LTS上使Java FX与OpenJDK 8一起运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文