i've programmed a little game in javafx in Eclipse. It uses 3 file-path url's to locate the images, sounds and savefile folders. My problem is that those url's have been hardcoded and therefor obviously only work on my computer. Like this:
public static String imageDir = "FILE:///D:/Users/tlins/eclipse-workspace/SpaceWars3.0/src/images/";
I want to export my game in a jar file and then the programm should figure out for itself where the assets are located. I originally assumed that it would start looking in the same folder as the main class, and that i could just type
public static String imageDir = "images/";
But it gave me an exception error "url not found" regardless.
So im just here to ask how you people normally do this? This can't be an uncommon thing right?
Should i somehow let the program figure out the EXACT path like shown (far) above? Or is there a way to inform it that it should start looking from the folder of main class?