Jump to content

  • Log In with Google      Sign In   
  • Create Account


Whats wrong?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
18 replies to this topic

#1 Dr Lazy Bean   Members   -  Reputation: 105

Like
0Likes
Like

Posted 25 July 2012 - 03:15 AM

i recently have encountered an error when i compile my game in eclispe and it started happening this afternoon
Exception in thread "main" java.lang.NullPointerException
at javagame.Game.initStatesList(Game.java:25)
at org.newdawn.slick.state.StateBasedGame.init(StateBasedGame.java:164)
at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:390)
at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:314)
at javagame.Game.main(Game.java:34)

Sponsor:

#2 Ashaman73   Crossbones+   -  Reputation: 6749

Like
0Likes
Like

Posted 25 July 2012 - 03:19 AM

Can you post the code from Game.java at line 25 (+ context, not just this line) ?

#3 Radikalizm   Crossbones+   -  Reputation: 2776

Like
0Likes
Like

Posted 25 July 2012 - 03:21 AM

Without any code or even any hint about what you're doing exactly we can't help you

When you encounter an error please post the code in which your error is occuring, mark the line of code where the code crashed, and give a description of what you're trying to do exactly.

I gets all your texture budgets!


#4 Dr Lazy Bean   Members   -  Reputation: 105

Like
0Likes
Like

Posted 25 July 2012 - 03:46 AM

package javagame;
import org.newdawn.slick.*;
import org.newdawn.slick.state.*;
public class Game extends StateBasedGame{
public static final String gamename = "Bucky's World!";
public static final int menu = 0;
public static final int play = 1;
public static final int play2 = 2;

public Game(String gamename){
super(gamename);
this.addState(new Menu(menu));
this.addState(new Play(play));


}

public void initStatesList(GameContainer gc) throws SlickException{

this.getState(menu).init(gc, this);
this.getState(play).init(gc, this);
this.getState(play2).init(gc, this);
this.enterState(menu);
}

public static void main(String[] args) {
AppGameContainer appgc;
try{
appgc = new AppGameContainer(new Game(gamename));
appgc.setDisplayMode(640, 360, false);
appgc.start();

}catch(SlickException e){
e.printStackTrace();
}
}
}

#5 Dr Lazy Bean   Members   -  Reputation: 105

Like
0Likes
Like

Posted 25 July 2012 - 04:47 AM

when i open the classes it says "Source not found"

Edited by rip-off, 25 July 2012 - 05:58 AM.
Please do not remove useful content from threads without good reason


#6 rip-off   Moderators   -  Reputation: 7706

Like
1Likes
Like

Posted 25 July 2012 - 04:47 AM

You've added two states to the list in the constructor, but in the initStatesList function you seem to be trying to initialise 3 states.

#7 Dr Lazy Bean   Members   -  Reputation: 105

Like
0Likes
Like

Posted 25 July 2012 - 04:48 AM

thanks, i forgot about that line when i remove my state

#8 Dr Lazy Bean   Members   -  Reputation: 105

Like
0Likes
Like

Posted 25 July 2012 - 04:49 AM

How do i turn my project into a .exe?

#9 BitMaster   Crossbones+   -  Reputation: 3681

Like
1Likes
Like

Posted 25 July 2012 - 04:53 AM

Is your intention to get rid of the JVM completely? In this case you would have to compile the Java sources to native code. I believe gcc can do that within certain limitations.
If you just want to hide the bytecode from the end user, there are several wrappers like http://launch4j.sourceforge.net/ which just fell out of Google.

#10 Dr Lazy Bean   Members   -  Reputation: 105

Like
0Likes
Like

Posted 25 July 2012 - 04:55 AM

I want to get rid of the JVM completely

#11 BitMaster   Crossbones+   -  Reputation: 3681

Like
0Likes
Like

Posted 25 July 2012 - 04:59 AM

As I said, gcc can probably do it. I would ask why though. A decent, modern JVM can do some pretty neat optimizations at runtime which a static compiler just cannot do.

#12 Dr Lazy Bean   Members   -  Reputation: 105

Like
0Likes
Like

Posted 25 July 2012 - 05:03 AM

Well im going to try both to see what the difference is :P
btw im really noob

#13 Dr Lazy Bean   Members   -  Reputation: 105

Like
0Likes
Like

Posted 25 July 2012 - 05:14 AM

i wrapped it in launchj4 but nothing happened when it opened :s

#14 Dr Lazy Bean   Members   -  Reputation: 105

Like
0Likes
Like

Posted 25 July 2012 - 05:40 AM

i even tried exporting as a runnable and it didnt launch
what do i do?

#15 Bluefirehawk   Crossbones+   -  Reputation: 1232

Like
0Likes
Like

Posted 25 July 2012 - 06:47 AM

You have to compile your code into a .jar file.

Here is a tutorial: http://www.horstmann.com/bigj/help/compiler/tutorial.html

Btw: Google is the programmers main tool.
You find many good tutorials, Q&A sections and documentations for java related stuff, try finding them with google, they will help you with many problems and questions you encounter in your programming life.
Project: Project
Setting fire to these damn cows one entry at a time!

#16 Malabyte   Members   -  Reputation: 583

Like
0Likes
Like

Posted 25 July 2012 - 06:37 PM

Google is the programmers main tool.


Not to mention Youtube, in a limited sense.

Edited by DrMadolite, 25 July 2012 - 06:37 PM.

- Awl you're base are belong me! -

- I don't know, I'm just a noob -


#17 Dr Lazy Bean   Members   -  Reputation: 105

Like
0Likes
Like

Posted 26 July 2012 - 02:39 AM

thanks for the help guys :)

#18 thok   Members   -  Reputation: 665

Like
1Likes
Like

Posted 26 July 2012 - 11:48 AM

I want to get rid of the JVM completely


Why?

btw im really noob


Okay, so in that case you don't to get rid of the JVM. Just launch4j if you want to create an exe. Otherwise, you can still just execute .jar files (hell, I think Minecraft still works this way doesn't it?).

#19 Dr Lazy Bean   Members   -  Reputation: 105

Like
-1Likes
Like

Posted 27 July 2012 - 06:40 AM

i dont know i wanted to sound smart




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS