Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (580)
games submitted by our members
Games in WIP (500)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  [Solved] CMD execution of my game crashes  (Read 769 times)
0 Members and 1 Guest are viewing this topic.
Offline Phased
« Posted 2012-09-23 16:41:35 »

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.


1  
2  
3  
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.
Offline matheus23

JGO Wizard


Medals: 97
Projects: 3


You think about my Avatar right now!


« Reply #1 - Posted 2012-09-23 17:00:26 »

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.
Eehh... erm... what? Cheesy 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...

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Offline Phased
« Reply #2 - Posted 2012-09-23 17:33:10 »

@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
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline matheus23

JGO Wizard


Medals: 97
Projects: 3


You think about my Avatar right now!


« Reply #3 - Posted 2012-09-23 18:08:56 »

I fixed it, wow, everytime I have a problem, I end up fixing it XD
I wish, I could feel like that everytime, haha Smiley

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (50 views)
2014-04-16 08:08:23

BurntPizza (46 views)
2014-04-15 17:46:01

UprightPath (62 views)
2014-04-15 07:39:50

UprightPath (44 views)
2014-04-15 07:35:47

Porlus (61 views)
2014-04-15 05:48:38

tom_mai78101 (85 views)
2014-04-10 18:04:31

BurntPizza (143 views)
2014-04-09 13:06:04

tom_mai78101 (242 views)
2014-04-06 03:34:39

trollwarrior1 (201 views)
2014-04-05 02:06:45

CJLetsGame (208 views)
2014-04-01 16:16:10
List of Learning Resources
by SHC
2014-04-18 17:17:39

List of Learning Resources
by Longarmx
2014-04-08 17:14:44

Good Examples
by matheus23
2014-04-06 03:51:37

Good Examples
by Grunnt
2014-04-04 05:48:46

Good Examples
by Grunnt
2014-04-04 05:48:37

Good Examples
by matheus23
2014-04-02 08:40:51

Good Examples
by matheus23
2014-04-02 08:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-12 05:22:30
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!