Server myServer;
public static ServerGame app;
static int port = 3501;
public static void main(String[] args) {
app = new ServerGame();
}[/java]
So what the is wrong?
When I export to jar I even pick out the mainclass so that the compiler wont even have to think about it. So what is wrong?
In dos Iv tried the following commands:
java ServerGame
java ServerGame.class
javaw ServerGame
javaw ServerGame.class
java ServerGame.java
javaw ServerGame.java
javac ServerGame
javac ServerGame.java
But presumably your application uses other jar files… like jMonkeyEngine.jar. The bundle that JMP puts together will automatically add these to the classpath entry in the manifest. It’s the only real way to make java -jar work right.
…but if eclipse is easier for you then I’m sure you’ll figure out a way to make it work.
Addez said:
So ur saying I have to import everything into the jme platform, then export it as jar?
What?
No, I'm saying that when you write a Java application that at some point that application will need access to its dependencies. For example, if you use a JME class then you will need the JME jar on your classpath.
When you run an application with -jar the only real way to specify the classpath is in the manifest.
And note: Java is not very good at accurately reporting which class is actually missing. If your main class refers to a class that can’t be found then sometimes Java will report your main class as not being found.
And since you are using eclipse where you have to do everything manually that JMP would do automatically… you also have to add the jar to your manifest’s classpath entry.
…or don’t run with -jar and run with -cp and fully specify your classpath.
Getting the classpath right is pretty basic Java stuff… I imagine even Eclipse will have some help on it somewhere.