[Solved] CMD execution of my game crashes

Well, this is kinda weird, It must be some tiny thing wrong.

I’m creating a launcher to allow the game to be downloaded, and played through a launcher.


Process p = null;
p = Runtime.getRuntime().exec("java -jar C:\\Users\\Owner\\AppData\\Roaming\\Phased\\release.jar");
//I have variables set to get the location, but I changed it back to this for testing purposes, havnt changed it back

surrounded with try and catch obviously, but when the game executes, the display would load but would fail, obviously the first thing was “oh what did i do wrong” so I go to the location, and double click the jar, it works perfectly, nothings wrong.

I check once again, it still fails, So to get the error message I use the console to find out that it can not find my images. the images are definitely their, they are outside of the jar in a folder called res (this is where I had to put the folder for it to work when double clicking the jar in the location). So knowing it works, I decide to copy the res folder and put it inside the jar. I test the launcher, once again, it fails, check the console, still cant find the images.

the res folder is inside the jar, outside the jar, in roaming folder, no res folder, without the res folder (but all images and folders inside the jar still outside), everything inside the res folder out and in the location.

Anyone know how to fix this? or a different way to execute my jar?

The execution works, I tried it with a earlier version of the game with no images, it works perfectly. Just can not find the images.

Eehh… erm… what? :smiley: I know, I’m not native english speaker, but seriously… I didn’t get that sentence…

Also:
This propably doesn’t solve you’re problem, but use "/"es instead of "\"es. The "/"es work under all platforms, and the "\"es only work in windows.
And:
Try to use the Runtime.getRuntime().exec(String command, String[] envp);. Sometimes (especially with file paths), there are some problems with the parsing of the arguments…

@matheus23
That sentence is basically me just saying, I have the images in heaps of different locations, meaning, its most likely not a location.

the runtime execution I’m using works its just, it cant find the images, like, the display creates, so the game window opens, then tries to add the images into the game, once the game tries to get the images, the game crashes.

I fixed it, wow, everytime I have a problem, I end up fixing it XD, I even postponed posting this to try and work it out XD, It was to do with my Image loading, I read up how to use the texture loading for slick, and the first one I used said to use new File(toFile); and having toFile set as “/res/image/play.png”. yes it worked perfect when I was executing the game through the jar, but as soon as I tried to execute it through the command line, it crashed. worked out the easiest was to just use slicks ResourceLoader class.

Like I said in the first line of OP, super simple mistake… should of waited that little bit longer XD

I wish, I could feel like that everytime, haha :slight_smile: