InputStream is null in IntelliJ but not in Eclipse

0

I'm switching from Eclipse to IntelliJ. But I can't start my project with IntelliJ. I have no problems with Eclipse. Is it a configuration error?

        String path = "/fxml/scene.fxml";
    InputStream fxmlStream = AppController.getInstance().getClass().getResourceAsStream(path);
    FXMLLoader loader = new FXMLLoader();
    loader.setBuilderFactory(new JavaFXBuilderFactory());
    loader.setLocation(AppController.getInstance().getClass().getResource(path));
    loader.setController(AppController.getInstance());
    Parent pane = (Parent) loader.load(fxmlStream); // this is line 30
    Scene scene = new Scene(pane);

Stacktrace:

    Aug 12, 2017 11:31:35 PM java.util.prefs.WindowsPreferences <init>
WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.
Exception in Application start method
Exception in Application stop method
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
    at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.RuntimeException: Exception in Application start method
    at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)
    at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$155(LauncherImpl.java:182)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NullPointerException: inputStream is null.
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2455)
    at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2425)
    at app.VLCPlayerLauncher.start(VLCPlayerLauncher.java:30) // this is my program
    ...

Process finished with exit code 1

Debugger: IntelliJ Debugger

What's wrong? Thanks. :)

java
eclipse
intellij-idea
javafx
asked on Stack Overflow Aug 12, 2017 by user3646958 • edited Aug 12, 2017 by user3646958

1 Answer

1

I added

        <resources>
        <resource>
            <directory>src/main/java</directory>
            <excludes>
                <exclude>**/*.java</exclude>
            </excludes>
        </resource>
    </resources>

to pom.xml.

answered on Stack Overflow Aug 12, 2017 by user3646958

User contributions licensed under CC BY-SA 3.0