javafx 2 - NPE in FXMLLoader -
I have a hybrid of Swing (legacy) and Java FX components is one such application. It worked fine until I threw the same as using a preloader place, now all my JavaFX components that fxml files in place and FXMLLoader try do not work because of an NPE New FXMLLoader () (with or without parameters), or FXMLLoader.load () .
I am using 64-bit Java 7u67.
stack shows trace:
On javafx.fxml on javafx.fxml.JavaFXBuilderFactory (JavaFXBuilderFactory.java:85) javafx.fxml.JavaFXBuilderFactory (JavaFXBuilderFactory.java: 53) but java.lang.NullPointerException ... FXMLLoader.load javafx.fxml.FXMLLoader.load on (FXMLLoader.java:2782) (FXMLLoader.java:2771)
His work is square before putting a preloader, a start And after that the main application of the main () method calls it basically the same thing in Preloader, where the main () method of application is called under the preloader () method.
I am stumped as to what is the reason. Any ideas?
I want to review the source code, but the people I found online reported on line # .
Anyway, whatever I saw, being by it, it appears that the default class loader is described in the transition as I have described. Do I have to set class loader for a working example was done to fix the problem, eg,
try {fxmlLoader = new FXMLLoader (getClass () getResource ( "Sample .fxml ").). } Grip (Exception e) {FXMLLoader.setDefaultClassLoader (Sample Controller Class. Tags ClassLoader ()); FxmlLoader = New FXML Loader (getClass (). GetResource ("Sample.fxml")); }
Of course, someone can go straight ahead and set the default class loader from the bat.
Comments
Post a Comment