3

I'm creating an app in JavaFX. I received this error while opening the scenebuilder: "Could not open Loggin.fxml. Open operation has failed. Make sure that the chosen file is a valid fxml document."

Clicking on "Show details", it shown me this error:

java.io.IOException: javafx.fxml.LoadException: 
/F:/Anusha/stophubsourcetree3/src/application/GetStarted.fxml

    at com.oracle.javafx.scenebuilder.kit.fxom.FXOMLoader.load(FXOMLoader.java:92)
    at com.oracle.javafx.scenebuilder.kit.fxom.FXOMDocument.<init>(FXOMDocument.java:80)
    at com.oracle.javafx.scenebuilder.kit.fxom.FXOMDocument.<init>(FXOMDocument.java:95)
    at com.oracle.javafx.scenebuilder.kit.editor.EditorController.updateFxomDocument(EditorController.java:2370)
    at com.oracle.javafx.scenebuilder.kit.editor.EditorController.setFxmlTextAndLocation(EditorController.java:655)
    at com.oracle.javafx.scenebuilder.app.DocumentWindowController.loadFromFile(DocumentWindowController.java:386)
    at com.oracle.javafx.scenebuilder.app.SceneBuilderApp.performOpenFiles(SceneBuilderApp.java:579)
    at com.oracle.javafx.scenebuilder.app.SceneBuilderApp.handleOpenFilesAction(SceneBuilderApp.java:447)
    at com.oracle.javafx.scenebuilder.app.SceneBuilderApp.handleLaunch(SceneBuilderApp.java:427)
    at com.oracle.javafx.scenebuilder.app.AppPlatform.requestStartGeneric(AppPlatform.java:139)
    at com.oracle.javafx.scenebuilder.app.AppPlatform.requestStart(AppPlatform.java:106)
    at com.oracle.javafx.scenebuilder.app.SceneBuilderApp.start(SceneBuilderApp.java:371)
    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: javafx.fxml.LoadException: 
/F:/Anusha/stophubsourcetree3/src/application/GetStarted.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.load(FXMLLoader.java:2425)
    at com.oracle.javafx.scenebuilder.kit.fxom.FXOMLoader.load(FXOMLoader.java:89)
    ... 22 more
Caused by: java.lang.ClassNotFoundException: com.jfoenix.controls.JFXTextField
    at java.lang.ClassLoader.findClass(ClassLoader.java:530)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    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)
    ... 27 more

my main.java:

package application;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.stage.Stage;
import javafx.scene.Parent;
import javafx.scene.Scene;


public class Main extends Application
{

    @Override

    public void start(Stage primaryStage)
    {
        try
        {
            Parent root =FXMLLoader.load(getClass().getResource("/application/GetStarted.fxml"));
            Scene scene = new Scene(root);
            scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
            primaryStage.setScene(scene);
            primaryStage.setTitle("LOGIN");
            primaryStage.setResizable(false);
            primaryStage.show();
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
    }

    public static void main(String[] args)
    {
        launch(args);
    }

}
mistletoe
  • 463
  • 4
  • 11
  • 29
  • It looks like you haven't included the jar file for your third party library in scenebuilder's library. See http://stackoverflow.com/questions/29601190/include-controls-fx-in-scene-builder for a similar question (albeit a different library). – James_D Nov 01 '16 at 19:40
  • Where can i find those jar files of the third party library? – mistletoe Nov 01 '16 at 19:57
  • Umm, wherever you put them? If you're using a third party library, you have presumably downloaded and installed it somewhere. Only you know where. – James_D Nov 01 '16 at 19:59
  • Thank for the help! :) I got it. – mistletoe Nov 01 '16 at 20:22

2 Answers2

2

The problem is that the SceneBuilder(Scene Builder is 8.2.0, it was released on May 18, 2016) in the current version when it opens it must firstly download the libraries and open the fxml file.It is like a bug,i will find the link and post it...

Although it will be fixed in the next update.

Solution for this version:

1)First open the SceneBuilder

2)Now open your fxml/fxml file/files

GOXR3PLUS
  • 6,877
  • 9
  • 44
  • 93
  • Okay, but is there any other way?I am again having problems.The solution which you provided is working.But it would be great if the Fxml file can be opened with the option 'open with scenebuilder'. – mistletoe Nov 05 '16 at 14:05
  • @mistletoe What i mean is,the `SceneBuilder` has to be opened, no matter if you have opened a file or not.Then the trick is here. `You just go on Eclipse or whenever you have the FXML file and double click it (if and only is SceneBuilder is opened,you only need one instance of it to be opened,so it has loaded the custom libraries)`. No need to open it from `SceneBuilder` menu :).... – GOXR3PLUS Nov 05 '16 at 15:57
  • @mistletoe In the next release of `SceneBuilder` that will be fixed,for now only some tricky ways are available,it is a known issue. – GOXR3PLUS Nov 05 '16 at 15:58
  • Thanks a lot really!:) :) – mistletoe Nov 05 '16 at 20:19
  • @mistletoe Enjoy – GOXR3PLUS Nov 05 '16 at 21:41
0

Make sure you have installed the libraries, that you import in your .fxml file, to Scene Builder.

This article provides a more detailed explanation: https://www.programmersought.com/article/66535163371/

J.Warnking
  • 1
  • 1
  • 2