【发布时间】:2020-02-09 18:32:59
【问题描述】:
我查看了许多类似的问题,但解决方案对我没有帮助:(
我可以通过两种方式导入库:
1. In the java build path 我可以毫无问题地使用所有类...但是我无法加载 java doc 或源代码,如果我这样做了,它就不起作用。
或者...
2. edit the installed JRE definitions 这样,我像在其他问题中解释的那样在已安装的 jre 中添加 jfxrt.jar,并为其提供源代码和文档。它有效! ...几乎...文档现在可以使用...但并非所有导入。 :(
import javafx.application.Platform; //this works
import javafx.scene.control.ListView; //this works
import javafx.scene.control.ProgressBar; //this works
import javafx.scene.control.TextField; //this works
import javafx.scene.layout.Background; //this DOES NOT work :(
import javafx.scene.layout.BackgroundFill;//this DOES NOT work :(
import javafx.scene.layout.Border; //this DOES NOT work :(
import javafx.scene.layout.BorderPane; //this works again ._.
我得到的错误是: "导入 javafx.scene.layout.Background 无法解析"
嗯...在执行第一步时(来自This is my openjfx lib)。我绝对没有导入问题,我可以完美地工作,但是文档不起作用。
现在有了2. edit the installed JRE definitions,文档确实可以工作,但我在某些东西上遇到了导入问题,我不明白为什么:(
显然我做错了什么......(我对java很陌生)
我的 java 版本:
java version "13" 2019-09-17
Java(TM) SE Runtime Environment (build 13+33)
Java HotSpot(TM) 64-Bit Server VM (build 13+33, mixed mode, sharing)
(我之前使用 fx 时遇到了一些错误,并通过更新我的 eclipse 2019-09 得到了修复)
嗯。我希望你能帮助我^^
【问题讨论】:
-
我也尝试了 e(fx)clipse 并在构建路径中添加了 fx-sdk 但无法解析每个导入
-
您从哪里获得了用于 JavaFX 11+ 的
jfxrt.jar?那已经不存在了。如果它来自旧版本(10 或更少),这可能会解释一些导入问题。但这不是做到这一点的方法。见openjfx.io/openjfx-docs/#IDE-Eclipse