I've stumbled upon the same problem. Program was running great from Eclipse via "Run" button, but NOT from runnable JAR which I'd exported before. My solution was:
1) Move Main class to default package
2) Set other path for Eclipse, and other while running from the JAR file (paste this into Main.java)
public static final String sourcePath = isProgramRunnedFromJar() ? "src/" : "";
public static boolean isProgramRunnedFromJar() {
File x = getCurrentJarFileLocation();
if(x.getAbsolutePath().contains("target"+File.separator+"classes")){
return false;
} else {
return true;
}
}
public static File getCurrentJarFileLocation() {
try {
return new File(Main.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath());
} catch(URISyntaxException e){
e.printStackTrace();
return null;
}
}
And after that in start method you have to load files like this:
FXMLLoader loader = new FXMLLoader(getClass().getResource(sourcePath +"MainScene.fxml"));
It works for me in Eclipse Mars with e(fx)clipse plugin.