Draw problem upon compile[SOLVED]

Ok, so I am having trouble with my Play menu, when I run my program under eclipse the layers get drawn in, however when I run it under its own executable they do not. Can someone take a look at my code.

Here is my source zipped up source

Also if you do not want to download anything I would be happy to let you connect directly to my project and take a look at it.

The problem was solved! It was a problem of calling an outside resource and not an inside

Have you run the jar from the command line? 99% of these situations are caused by errors that will show up in the command line.

Also, just so you know: Eclipse complies your code whenever you run it inside Eclipse, so this isn’t a “post-compilation” problem, it’s a “post-export” problem.

I have, and it did the same thing. I see, well something is going on here xD I just can not figure out what.

It does draw the player though, It is almost like it is just not reading the map files.

Throw in some print lines when you load the maps in. Run it from the command line and see if everything works out ok.

It works perfectly fin when I run it straight from eclipse, it just does this when It is ran as an independent jar file.

I know. That’s why I said to print out what’s happening so you can see if it works when exported.

Well if loads the ground.draw, perfectly fine during bother I used
g.setColor(Color.YELLOW);
g.drawString(“Map loaded”, 50,50);

and Map loaded shows when It is ran as an independent and when I run it through eclipse. So it is having trouble loading the grounds mapfile.

I see in your code you’re using FileReaders. That won’t work on files that are packaged inside a jar file.
Solution to that is to either:

  • Not have the files packed in the jar, but instead alongside the jar.
  • Use Class.getResourceAsStream()

Look up those if you don’t know what I’m talking about.

I could help more, but I would rather not download your entire project. Could you post the relevant code?

It works! YAY xD thank you very much sir. I will look up Class.getResourceAsStream() because I do want the map files packed into my jar.
@opiop65. Thank you for attempting to help as well. All of the help is much appreciated!