How to import maked javafx jar file into scene builder?

600 Views Asked by At

I've developting custom control. Like this. I complete making this control.

And then. I wanted to use it in scene builder. So, I export my file to jar. And I import jar file in Scene builder.

But, Scene builder print noting. Like this.

First of all my struecture is like this. One control match One skin.

sample
    control
        DateChooser.java
        DateChooserSkin.java
        DatePickerForm.java
        DatePickerFormSkin.java
    css
         ....
    image
         ....
    fxml 
         sample.fxml
    Main.java

I have two control. So, the result is Like this UI is consist of one textFeild and one datePciker.

I wrote fxml code and Main. java like this.

<AnchorPane prefHeight="320.0" prefWidth="240.0" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1" >
     <DatePickerForm></DatePickerForm>
</AnchorPane>


public class Main extends Application {

    @Override
    public void start(Stage primaryStage) throws Exception{
        primaryStage.setTitle("Hello World!");
        Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));
        Scene scene = new Scene(root, 300, 250);
        primaryStage.setScene(scene);
        primaryStage.show();
    }

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

I was proceed exporting jar.

Choose Main method and I exported. and then I just put this jar to Scene builder. But The result is terrible.

What is wrong? Please Help me.

My error log is this

xception for: sample/DateChooser.class javafx.fxml.LoadException: unknown path:2

at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2617)

at javafx.fxml.FXMLLoader.access$700(FXMLLoader.java:104)

at javafx.fxml.FXMLLoader$InstanceDeclarationElement.constructValue(FXMLLoader.java:1012)

at javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:740)

at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2723)

at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2527)

at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2425)

at com.oracle.javafx.scenebuilder.kit.library.util.JarExplorer.instantiateWithFXMLLoader(JarExplorer.java:105)

at com.oracle.javafx.scenebuilder.kit.library.util.JarExplorer.exploreEntry(JarExplorer.java:146)

at com.oracle.javafx.scenebuilder.kit.library.util.JarExplorer.explore(JarExplorer.java:65)

at com.oracle.javafx.scenebuilder.kit.library.user.LibraryFolderWatcher.exploreAndUpdateLibrary(LibraryFolderWatcher.java:298)

at com.oracle.javafx.scenebuilder.kit.library.user.LibraryFolderWatcher.runDiscovery(LibraryFolderWatcher.java:122)

at com.oracle.javafx.scenebuilder.kit.library.user.LibraryFolderWatcher.run(LibraryFolderWatcher.java:88)

at java.lang.Thread.run(Thread.java:744)

Caused by: java.lang.InstantiationException: sample.DateChooser

at java.lang.Class.newInstance(Class.java:418)

at sun.reflect.misc.ReflectUtil.newInstance(ReflectUtil.java:51)

at javafx.fxml.FXMLLoader$InstanceDeclarationElement.constructValue(FXMLLoader.java:1010)

... 11 more

Caused by: java.lang.NoSuchMethodException: sample.DateChooser.()

at java.lang.Class.getConstructor0(Class.java:2971)

at java.lang.Class.newInstance(Class.java:403)

... 13 more

Exception for: sample/DateChooserSkin.class javafx.fxml.LoadException: unknown path:2

at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2617)

at javafx.fxml.FXMLLoader.access$700(FXMLLoader.java:104)

at javafx.fxml.FXMLLoader$InstanceDeclarationElement.constructValue(FXMLLoader.java:1012)

at javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:740)

at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2723)

at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2527)

at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2425)

at com.oracle.javafx.scenebuilder.kit.library.util.JarExplorer.instantiateWithFXMLLoader(JarExplorer.java:105)

at com.oracle.javafx.scenebuilder.kit.library.util.JarExplorer.exploreEntry(JarExplorer.java:146)

at com.oracle.javafx.scenebuilder.kit.library.util.JarExplorer.explore(JarExplorer.java:65)

at com.oracle.javafx.scenebuilder.kit.library.user.LibraryFolderWatcher.exploreAndUpdateLibrary(LibraryFolderWatcher.java:298)

at com.oracle.javafx.scenebuilder.kit.library.user.LibraryFolderWatcher.runDiscovery(LibraryFolderWatcher.java:122)

at com.oracle.javafx.scenebuilder.kit.library.user.LibraryFolderWatcher.run(LibraryFolderWatcher.java:88)

at java.lang.Thread.run(Thread.java:744)

Caused by: java.lang.InstantiationException: sample.DateChooserSkin

at java.lang.Class.newInstance(Class.java:418)

at sun.reflect.misc.ReflectUtil.newInstance(ReflectUtil.java:51)

at javafx.fxml.FXMLLoader$InstanceDeclarationElement.constructValue(FXMLLoader.java:1010)

... 11 more

Caused by: java.lang.NoSuchMethodException: sample.DateChooserSkin.()

at java.lang.Class.getConstructor0(Class.java:2971)

at java.lang.Class.newInstance(Class.java:403)

... 13 more

Exception for: sample/DatePickerForm.class javafx.fxml.LoadException: unknown path:2

at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2617)

at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2595)

at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2425)

at com.oracle.javafx.scenebuilder.kit.library.util.JarExplorer.instantiateWithFXMLLoader(JarExplorer.java:105)

at com.oracle.javafx.scenebuilder.kit.library.util.JarExplorer.exploreEntry(JarExplorer.java:146)

at com.oracle.javafx.scenebuilder.kit.library.util.JarExplorer.explore(JarExplorer.java:65)

at com.oracle.javafx.scenebuilder.kit.library.user.LibraryFolderWatcher.exploreAndUpdateLibrary(LibraryFolderWatcher.java:298)

at com.oracle.javafx.scenebuilder.kit.library.user.LibraryFolderWatcher.runDiscovery(LibraryFolderWatcher.java:122)

at com.oracle.javafx.scenebuilder.kit.library.user.LibraryFolderWatcher.run(LibraryFolderWatcher.java:88)

at java.lang.Thread.run(Thread.java:744)

Caused by: java.lang.IllegalStateException: Not on FX application thread; currentThread = LibraryFolderWatcher(C:\Users\GSD\AppData\Roaming\Scene Builder/Library)

at com.sun.javafx.tk.Toolkit.checkFxUserThread(Toolkit.java:210)

at com.sun.javafx.tk.quantum.QuantumToolkit.checkFxUserThread(QuantumToolkit.java:393)

at javafx.scene.Scene.<init>(Scene.java:374)

at javafx.scene.Scene.<init>(Scene.java:232)

at javafx.scene.Scene$3$1.<init>(Scene.java:436)

at javafx.scene.Scene$3.createPopupScene(Scene.java:436)

at com.sun.javafx.scene.SceneHelper.createPopupScene(SceneHelper.java:59)

at javafx.stage.PopupWindow.<init>(PopupWindow.java:142)

at javafx.stage.Popup.<init>(Popup.java:39)

at sample.DatePickerForm.<init>(DatePickerForm.java:32)

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

at java.lang.reflect.Constructor.newInstance(Constructor.java:408)

at java.lang.Class.newInstance(Class.java:433)

at sun.reflect.misc.ReflectUtil.newInstance(ReflectUtil.java:51)

at javafx.fxml.FXMLLoader$InstanceDeclarationElement.constructValue(FXMLLoader.java:1010)

at javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:740)

at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2723)

at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2527)

... 8 more

Exception for: sample/DatePickerFormSkin.class javafx.fxml.LoadException: unknown path:2

at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2617)

at javafx.fxml.FXMLLoader.access$700(FXMLLoader.java:104)

at javafx.fxml.FXMLLoader$InstanceDeclarationElement.constructValue(FXMLLoader.java:1012)

at javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:740)

at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2723)

at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2527)

at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2425)

at com.oracle.javafx.scenebuilder.kit.library.util.JarExplorer.instantiateWithFXMLLoader(JarExplorer.java:105)

at com.oracle.javafx.scenebuilder.kit.library.util.JarExplorer.exploreEntry(JarExplorer.java:146)

at com.oracle.javafx.scenebuilder.kit.library.util.JarExplorer.explore(JarExplorer.java:65)

at com.oracle.javafx.scenebuilder.kit.library.user.LibraryFolderWatcher.exploreAndUpdateLibrary(LibraryFolderWatcher.java:298)

at com.oracle.javafx.scenebuilder.kit.library.user.LibraryFolderWatcher.runDiscovery(LibraryFolderWatcher.java:122)

at com.oracle.javafx.scenebuilder.kit.library.user.LibraryFolderWatcher.run(LibraryFolderWatcher.java:88)

at java.lang.Thread.run(Thread.java:744)

Caused by: java.lang.InstantiationException: sample.DatePickerFormSkin

at java.lang.Class.newInstance(Class.java:418)

at sun.reflect.misc.ReflectUtil.newInstance(ReflectUtil.java:51)

at javafx.fxml.FXMLLoader$InstanceDeclarationElement.constructValue(FXMLLoader.java:1010)

... 11 more

Caused by: java.lang.NoSuchMethodException: sample.DatePickerFormSkin.()

at java.lang.Class.getConstructor0(Class.java:2971)

at java.lang.Class.newInstance(Class.java:403)

... 13 more

Not a Node: sample/Main.class

0

There are 0 best solutions below