【问题标题】:how to fix the error triggered by the use of jfoenix?如何修复使用 jfoenix 触发的错误?
【发布时间】:2020-11-08 04:38:57
【问题描述】:

我将 JFoenix 添加到 eclipse 和 SceneBuilder。 它在 SceneBuilder 中工作,但在编译项目时会导致 ClassNotFoundException

javafx.fxml.LoadException: /C:/Users/Dell/eclipse-workspace/WDP-solver/bin/application/Sample.fxml
at javafx.fxml/javafx.fxml.FXMLLoader.constructLoadException(Unknown Source)
at javafx.fxml/javafx.fxml.FXMLLoader.importClass(Unknown Source)
at javafx.fxml/javafx.fxml.FXMLLoader.processImport(Unknown Source)
at javafx.fxml/javafx.fxml.FXMLLoader.processProcessingInstruction(Unknown Source)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml/javafx.fxml.FXMLLoader.load(Unknown Source)
at application.Main.start(Main.java:13)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(Unknown Source)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$11(Unknown Source)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$9(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(Unknown Source)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: com.jfoenix.controls.JFXButton
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
at javafx.fxml/javafx.fxml.FXMLLoader.loadTypeForPackage(Unknown Source)
at javafx.fxml/javafx.fxml.FXMLLoader.loadType(Unknown Source)
... 21 more

【问题讨论】:

    标签: java eclipse javafx scenebuilder jfoenix


    【解决方案1】:

    scenebuilder 可以找到jphoenix 库,但是您的项目/您编写的 java 代码找不到 jphoenix 库。这就是您收到ClassNotFoundException 的原因。因此,要解决此问题,您必须在项目中导入 jar 文件。我自己不使用eclipse,所以我自己不知道该怎么做。一个快速的谷歌揭示了这个答案:

    how-to-import-a-jar-in-eclipse

    据此,You can add a jar in Eclipse by right-clicking on the Project → Build Path → Configure Build Path. Under Libraries tab, click Add Jars or Add External JARs and give the Jar. 也许这会有所帮助。导入后,您的项目应该可以正确编译。祝你好运。

    【讨论】:

    • 在我的情况下,jar 也是在 eclipse 上导入的!这就是问题
    猜你喜欢
    • 2013-01-28
    • 1970-01-01
    • 1970-01-01
    • 2019-04-05
    • 2019-09-19
    • 2019-11-27
    • 1970-01-01
    • 2021-07-07
    • 1970-01-01
    相关资源
    最近更新 更多