Although we recommend the jMonkeyEngine SDK for developing JME3 games, you can use any IDE (integrated development environment) such as NetBeans or Eclipse, and even work freely from the commandline. Here is a generic IDE-independent “getting started tutorial.

This example shows how to set up and run a simple application (HelloJME3) that depends on the jMonkeyEngine3 libraries.

The directory structure will look as follows:


Installing the JME3 Framework

To install the development version of jme3, download the nightly build, unzip the folder into a directory named jme3. The filenames here are just an example, but they will always be something like jME3_xx-xx-2011.

mkdir jme3
cd jme3

Alternatively, you can build JME3 from the sources. (Recommended for JME3 developers.)

svn checkout jme3
cd jme3
ant run
cd ..

If you see a Test Chooser application open now, the build was successful. Tip: Use just ant instead of ant run to build the libraries without running the demos.

Sample Project Directory Structure

First we set up the directory and source package structure for your game project. Note that the game project directory HelloJME3 is on the same level as your jme3 checkout. In this example, we create a Java package that we call hello in the source directory.

mkdir HelloJME3
mkdir HelloJME3/src
mkdir HelloJME3/src/hello


Next you copy the necessary JAR libraries from the download to your project. You only have to do this set of steps once every time you download a new JME3 build. For a detailed description of the separate jar files see this list.

mkdir HelloJME3/build
mkdir HelloJME3/lib
cp jme3/lib/*.* HelloJME3/lib

If you have built JME3 from the sources, then the copy paths are different:

mkdir HelloJME3/build
mkdir HelloJME3/lib
cp jme3/dist/*.* HelloJME3/lib

Sample Code

To test your setup, create the file HelloJME3/src/hello/ with any text editor, paste the following sample code, and save.

package hello;

import com.jme3.material.Material;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;
import com.jme3.math.ColorRGBA;

public class HelloJME3 extends SimpleApplication {

    public static void main(String[] args){
        HelloJME3 app = new HelloJME3();

    public void simpleInitApp() {
        Box b = new Box(Vector3f.ZERO, 1, 1, 1);
        Geometry geom = new Geometry("Box", b);
        Material mat = new Material(assetManager,
        mat.setColor("Color", ColorRGBA.Blue);

Build and Run

We build the sample application into the build directory…

cd HelloJME3
javac -d build -cp "lib/eventbus-1.4.jar:lib/j-ogg-oggd.jar:lib/j-ogg-vorbisd.jar:lib/jME3-lwjgl-natives.jar:lib/jbullet.jar:lib/jinput.jar:lib/lwjgl.jar:lib/stack-alloc.jar:lib/vecmath.jar:lib/xmlpull-xpp3-1.1.4c.jar:lib/jME3-blender.jar:lib/jME3-core.jar:lib/jME3-desktop.jar:lib/jME3-jogg.jar:lib/jME3-plugins.jar:lib/jME3-terrain.jar:lib/jME3-testdata.jar:lib/jME3-niftygui.jar:lib/nifty-default-controls.jar:lib/nifty-examples.jar:lib/nifty-style-black.jar:lib/nifty.jar:." src/hello/

… and run it.

cd build
java -cp "../lib/eventbus-1.4.jar:../lib/j-ogg-oggd.jar:../lib/j-ogg-vorbisd.jar:../lib/jME3-lwjgl-natives.jar:../lib/jbullet.jar:../lib/jinput.jar:../lib/lwjgl.jar:../lib/stack-alloc.jar:../lib/vecmath.jar:../lib/xmlpull-xpp3-1.1.4c.jar:../lib/jME3-blender.jar:../lib/jME3-core.jar:../lib/jME3-desktop.jar:../lib/jME3-jogg.jar:../lib/jME3-plugins.jar:../lib/jME3-terrain.jar:../lib/jME3-testdata.jar:../lib/jME3-niftygui.jar:../lib/nifty-default-controls.jar:../lib/nifty-examples.jar:../lib/nifty-style-black.jar:../lib/nifty.jar:." hello/HelloJME3

Note: If you use Windows, the classpath separator is “; instead of “:.

If a settings dialog pops up, confirm the default settings. You should now see a simple window with a 3-D cube. Use the mouse and the WASD keys to move. It works!

For multi-media files, models, and other assets, we recommend creating the following project structure:

cd HelloJME3
mkdir assets
mkdir assets/Interface
mkdir assets/Materials
mkdir assets/MatDefs
mkdir assets/Models
mkdir assets/Scenes
mkdir assets/Shaders
mkdir assets/Sounds
mkdir assets/Textures

This directory structure will allow SimpleApplication's default AssetManager to load media files from your assets directory, like in this example:

import com.jme3.scene.Spatial;
  Spatial elephant = assetManager.loadModel("Models/Elephant/Elephant.meshxml");

You will learn more about the asset manager and how to customize it later. For now feel free to structure your assets (images, textures, models) into further sub-directories, like in this example the assets/models/Elephant directory that contains the elephant.meshxml model and its materials.

Next Steps

Now follow the tutorials and write your first jMonkeyEngine game.