Cannot get FXMLLoader to load this fxml.
Error:

Feb 19, 2014 11:25:01 PM com.github.geodox.goldminer.GoldMiner start
SEVERE: null
java.lang.NullPointerException: Location is required.
    at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2825)
    at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2809)
    at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2795)
    at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2782)
    at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2771)
    at com.github.geodox.goldminer.GoldMiner.start(GoldMiner.java:24)
    at com.sun.javafx.application.LauncherImpl$5.run(LauncherImpl.java:319)
    at com.sun.javafx.application.PlatformImpl$5.run(PlatformImpl.java:219)
    at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:182)
    at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:179)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:179)
    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(Unknown Source)

Code:

package com.github.geodox.goldminer;

import java.util.logging.Level;
import java.util.logging.Logger;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;

public class GoldMiner extends Application
{   
    public boolean running;

    public static void main(String[] args)
    {
        Application.launch(GoldMiner.class, (java.lang.String[])null);
    }

    @Override
    public void start(Stage primaryStage) {
        try {
            VBox page = (VBox) FXMLLoader.load(GoldMiner.class.getResource("GoldMiner.fxml"));
            Scene scene = new Scene(page);
            primaryStage.setScene(scene);
            primaryStage.show();
        } catch (Exception ex) {
            Logger.getLogger(GoldMiner.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

}

Solved, FXML need to be in bin directory, and forgot the / at the beginning on the path on line 24.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.