3

PC では問題なく動作するが、ラップトップではまったく動作しない javafx アプリがあります。PC とラップトップで同じ設定をしていると思います。

  • NetBeans 7.4
  • Java 1.7.0_45

これが開始方法です

@Override
public void start(Stage stage) throws Exception {
    FXMLLoader loader = new FXMLLoader();

    Parent fxmlRoot = (Parent) loader.load(new FileInputStream(new File(
            "src\\com\\gasstation\\views\\main-layout.fxml")));

    Scene scene = new Scene(fxmlRoot);

    stage.setScene(scene);
    stage.show();

    GasStationXmlParser parser = new GasStationXmlParser("src\\config.xml");
    newGasStation = parser.getGasStations();

    MainController mainController = loader.getController();

    for (GasStation station : newGasStation) {
        mainController.setConfigData(station);
    }

    startAllGasStations();
}

アプリを実行しようとすると、次のようになります。

java.lang.NullPointerException
at javafx.fxml.FXMLLoader.equals(FXMLLoader.java:1855)
at javafx.fxml.FXMLLoader.isCyclic(FXMLLoader.java:1867)
at javafx.fxml.FXMLLoader.access$2200(FXMLLoader.java:66)
at javafx.fxml.FXMLLoader$IncludeElement.constructValue(FXMLLoader.java:935)
at javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:565)
at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2348)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2164)
at com.gasstation.main.Main.start(Main.java:27)
at com.sun.javafx.application.LauncherImpl$5.run(LauncherImpl.java:319)
at com.sun.javafx.application.PlatformImpl$5.run(PlatformImpl.java:216)
at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:179)
at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:176)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:176)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:76)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:17)
at com.sun.glass.ui.win.WinApplication$3$1.run(WinApplication.java:67)
at java.lang.Thread.run(Thread.java:744)
Exception in Application start method
Exception in thread "main" java.lang.RuntimeException: Exception in Application start method
    at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:403)
    at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:47)
    at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:115)
    at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.NullPointerException
    at javafx.stage.Window.impl_visibleChanging(Window.java:816)
    at javafx.stage.Stage.impl_visibleChanging(Stage.java:922)
    at javafx.stage.Window$9.invalidated(Window.java:690)
    at javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:127)
    at javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:161)
    at javafx.stage.Window.setShowing(Window.java:779)
    at javafx.stage.Window.show(Window.java:794)
    at javafx.stage.Stage.show(Stage.java:229)
    at com.gasstation.main.Main.start(Main.java:37)
    at com.sun.javafx.application.LauncherImpl$5.run(LauncherImpl.java:319)
    at com.sun.javafx.application.PlatformImpl$5.run(PlatformImpl.java:216)
    at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:179)
    at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:176)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:176)
    at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:76)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:17)
    at com.sun.glass.ui.win.WinApplication$3$1.run(WinApplication.java:67)
    ... 1 more
Java Result: 1

そして、私はそれから何も解決できませんでした...

何か案は?

4

1 に答える 1

0

loader.setLocation(Main.class.getResource(/com/gasstation/views/main-layout.fxml));事前に電話してみるParent fxmlRoot = (Parent) loader.load(new FileInputStream(new File("src\com\gasstation\views\main-layout.fxml")));

于 2013-11-18T04:07:48.963 に答える