Hi, after trying at least 15 of the supposed solutions without success, I found the problem.
It was a simple LowerCase/UpperCase mixup: Windows is niot case-sensitive in filename --> running from IDE is ok. Java Runtimes are case-sensitive when searching in the .jar file --> problem (fenster1.fxml <--> Fenster1.fxml) Thanks Helmut Am 15.06.2019 um 12:23 schrieb Geertjan Wielenga: > When I google ‘JavaFX location is not set’, I see quite a few > responses and solutions. > > Gj > > > On Sat, 15 Jun 2019 at 11:42, Helmut Leininger <[email protected] > <mailto:[email protected]>> wrote: > > Hi, > > I do not know if this is the correct place to ask. > > I am running Windows10, netbeans 11,openjdk 12, javafx 12. > > I am developping a modular javafx application, using Ant (i.e. no > Maven, > no Gradle). > > I have several modules (Mainmodule, Tools, UI). In the UI module > is the > package MainWindow, where the MainApp, all controllers and all > FXML-files reside. > In the MainController, when a certain Button is clicked, I open > another > Window (of the same package). > > The code sniplet: > > FXMLLoader fxmlLoader =3D new > FXMLLoader(getClass().getResource("fenster1.fxml")); > System.out.println("Location: " + fxmlLoader.getLocation()); > Parent rootFenster1 =3D (Parent) fxmlLoader.load (); > Fenster1 =3D new Stage(); > ... > > > This works well when run from the IDE. When run from the comand > line, I > get the following errors whenn trying to open the second window: > > dist>C:\OpenSourceTools\jdk-12/bin/java > --module-path=3D%JAVAFX_HOME%\lib > --add-modules=3Djavafx.controls,javafx.fxml -cp UI.jar > MainWindow.MainApp > Location: null > java.lang.IllegalStateException: Location is not set. > at > javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2459) > at javafx.fxml/javafx.fxml.FXMLLoader.load(FXMLLoader.java:2435 > > > What has to be done that the FXMLLoader can find the FXML file > also when > run from the comand line? > > Regards > > Helmut >
<<attachment: h_leininger.vcf>>
signature.asc
Description: OpenPGP digital signature
