[solved]Cannot run my own, simple games, although tutorial examples work fine

Hi!

I've just installed JME and JMEPhysics, using Netbeans CVS options. Tutorials from both of them, launched by TestChooser, work fine.



My own program, very simple, made on the base of JME Wiki as a Netbeans project, compiles with "BUILD SUCCESFUL" information and no errors no warnings. However, when it comes to launching it, it finishes immediately with an exeption :



java.lang.NoClassDefFoundError: z

Exception in thread "main"

Java Result: 1





I have no idea what to do… Help please …

Sounds like some kind of setup issue… classpath maybe?  I don't use netbeans so I couldn't say more than that.  Maybe try Eclipse instead?

I've followed all the instructions from here:

http://www.jmonkeyengine.com/wiki/doku.php?id=setting_up_netbeans_5.0_to_build_jme_and_jme-physics_2



Changing IDE to Eclipse is impossible - I got used to NB :slight_smile:

As Renanse said this seems like a classpath issue.  Why is it looking for a class named 'z'?  Or did you simply substitute that in for the real class name?  Is there any additional output you can include?  How about posting some of your source?  More information is going to be needed to help answer this question.

I always get this error when I incorrectly type the package name for classes in NetBeans. (It doesnt seem to pick up on the wrong package path)

Check the package is correct for the class main() exists in and the class it is instantiating to start your game.

Here is the code, taken from one of the tutorials.


package testjme;

import com.jme.app.SimpleGame;
import com.jme.bounding.BoundingBox;
import com.jme.bounding.BoundingSphere;
import com.jme.math.Vector3f;
import com.jme.renderer.ColorRGBA;
import com.jme.scene.Node;
import com.jme.scene.shape.Box;
import com.jme.scene.shape.Sphere;
import com.jme.scene.state.LightState;


/**
 * Started Date: Jul 20, 2004<br><br>
 *
 * Simple Node object with a few Geometry manipulators.
 *
 * @author Jack Lindamood
 */
public class Main extends SimpleGame {
 public static void main(String[] args) {
  Main app = new Main();
  app.setDialogBehaviour(SimpleGame.ALWAYS_SHOW_PROPS_DIALOG);
  app.start();
 }
 protected void simpleInitGame() {
            Box b=new Box("My Box",new Vector3f(0,0,0),new Vector3f(1,1,1));
            // Give the box a bounds object to allow it to be culled
            b.setModelBound(new BoundingSphere());
           
            // Calculate the best bounds for the object you gave it
            b.updateModelBound();
            // Move the box 2 in the y direction up
            b.setLocalTranslation(new Vector3f(0,2,0));
            // Give the box a solid color of blue.
            b.setSolidColor(ColorRGBA.blue);
            Sphere s=new Sphere("My sphere",10,10,1f);
            // Do bounds for the sphere, but we'll use a BoundingBox this time
            s.setModelBound(new BoundingBox());
            s.updateModelBound();
            // Give the sphere random colors
            s.setRandomColors();
            // Make a node and give it children
            Node n=new Node("My Node");
            n.attachChild(b);
            n.attachChild(s);
            // Make the node and all its children 5 times larger.
            n.setLocalScale(5);
            // Remove lighting for rootNode so that it will use our
            //basic colors.
            rootNode.setLightCombineMode(LightState.OFF);
            rootNode.attachChild(n);

 }
}



Project name : TestJme.
Package name : testjme
Main class name : Main.java (its code is shown above)
Netbeans version  : 5.5
Libraries added : jME-compile,jME-run,JMEphysics-compile (created on the base of tutorial from jme wiki)

Complete compilation output :

init:
deps-jar:
compile:
To run this application from the command line without Ant, try:
java -jar "C:Documents and SettingskamykPulpitTestJmedistTestJme.jar"
jar:
BUILD SUCCESSFUL (total time: 0 seconds)



Complete run output :


init:
deps-jar:
compile:
run:
java.lang.NoClassDefFoundError: z
Exception in thread "main"
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)



@Adamgp -> as you see package name seems ok, it is the same in project and in the code of the class

I'll try to run it from the cmd to check maybe...

Heh, I've managed to run it from the command line.



It seems that Netbeans has problems with paths in VM options.



That's what I write in cmd:


C:Documents and SettingskamykPulpitTestJme>
java -jar -Djava.library.path="G:dysk z lewegojmejmelib;G:dysk z lewegojmephysicsjmephysicsimplodelib"
distTestJme.jar



It works.

That's what I have in project->properties->run->VM options

-Djava.library.path=

Glad you got it working!