When opening the jar file, I can see the list of the fxml's in the main/resource folder, but it is still giving me the "java.lang.NullPointerException: Location is required." error.
package fxproject;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class ApplicationSplashScreen extends Application
{
Stage window;
public static void main(String args[])
{
launch(args);
}
@Override
public void start(Stage primaryStage) throws Exception
{
window = primaryStage;
loadDatabaseScreen();
window.close();
}
private void loadDatabaseScreen()
{
try
{
Stage stage = new Stage();
Parent root = FXMLLoader.load(getClass().getResource("../main/resources/DatabaseSettingsForm.fxml"));
Scene scene = new Scene(root);
stage.setScene(scene);
stage.sizeToScene();
stage.show();
}
catch(Exception e)
{
new OrchidAlertBox("Error",e.toString());
}
}
}
I suggest a simple try: Find the current directory and then paste (or using absolute path) fxml
to that directory:
public static void main(String args[])
{
//1. find current working directory
System.out.println(new File(".").getAbsolutePath());
//2. paste fxml's to this directory or modify ../main/.. to absolute path
//3. run program again?
launch(args);
}