1

I tried to find a similar question, but I couldn't. While running JavaFX, I get an error that seems to indicate that a certain class, ButtonBar, isn't found at runtime. This is the stacktrace:

Mar 20, 2016 1:02:35 PM javafx.fxml.FXMLLoader$ValueElement processValue
WARNING: Loading FXML document with JavaFX API of version 8.0.40 by JavaFX runtime of version 8.0.0
javafx.fxml.LoadException: 
/C:/Users/kanishk%20tantia/Workspace/AddressApp-Part-1/bin/ch/makery/address/view/PersonOverview.fxml

    at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2617)
    at javafx.fxml.FXMLLoader.importClass(FXMLLoader.java:2864)
    at javafx.fxml.FXMLLoader.processImport(FXMLLoader.java:2708)
    at javafx.fxml.FXMLLoader.processProcessingInstruction(FXMLLoader.java:2677)
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2517)
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441)
    at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2409)
    at ch.makery.address.MainApp.showPersonOverview(MainApp.java:54)
    at ch.makery.address.MainApp.start(MainApp.java:24)
    at com.sun.javafx.application.LauncherImpl$8.run(LauncherImpl.java:837)
    at com.sun.javafx.application.PlatformImpl$7.run(PlatformImpl.java:335)
    at com.sun.javafx.application.PlatformImpl$6$1.run(PlatformImpl.java:301)
    at com.sun.javafx.application.PlatformImpl$6$1.run(PlatformImpl.java:298)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl$6.run(PlatformImpl.java:298)
    at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.access$300(WinApplication.java:39)
    at com.sun.glass.ui.win.WinApplication$4$1.run(WinApplication.java:112)
    at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.ClassNotFoundException: javafx.scene.control.ButtonBar
    at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at javafx.fxml.FXMLLoader.loadTypeForPackage(FXMLLoader.java:2932)
    at javafx.fxml.FXMLLoader.loadType(FXMLLoader.java:2921)
    at javafx.fxml.FXMLLoader.importClass(FXMLLoader.java:2862)
    ... 18 more

The relevant part of the FXML file: Imports:

<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.control.*?>
<?import java.lang.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.control.ButtonBar?>

And the ButtonBar code:

<ButtonBar layoutX="54.0" layoutY="250.0" AnchorPane.bottomAnchor="10.0"  AnchorPane.rightAnchor="10.0">
    <buttons>
        <Button mnemonicParsing="false" text="New..." />
        <Button mnemonicParsing="false" text="Edit..." />
        <Button mnemonicParsing="false" text="Delete" />
    </buttons>
</ButtonBar>

2 Answers 2

2

Okay, I got it.

So, the issue was that I had multiple conflicting versions of Java, and Eclipse didn't use the latest one. By manually uninstalling each of the older versions, Eclipse started using Java 8u73, which had JavaFX 8u73. This meant that the buttonbar class was a part of the JavaFX class.

So, cross-compatibility is important is what I'm saying.

Sign up to request clarification or add additional context in comments.

2 Comments

There is no need to uninstall older versions. In Eclipse, just go to Preferences -> Java -> Installed JREs and make sure the latest one you have installed on your system is included in the list. Click "Add" and go through the wizard if it's not. Check the box next to the one you want to be the default execution environment.
Hey! So I did change the Installed JRE's. My default was JDK 8, which I guess was the problem, but this seems to have gotten fixed when I uninstalled the older versions. I guess your solution is probably the correct method though. Thanks a lot!
1

ClassNotFound exceptions usually indicate wrong versioning with APIs.

WARNING: Loading FXML document with JavaFX API of version 8.0.40 by JavaFX runtime of version 8.0.0

You're running JavaFX 8.0.0. But the ButtonBar is 8.0.40.

Documentation of ButtonBar

Since: JavaFX 8u40

1 Comment

How do I update/change the JavaFX runtime? I'm using the Java 8 JDK, which should be 8u73. So why is JavaFX at 8.0.0?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.