Setting up JME3 in Netbeans 6.x

You are welcome to try out the new jME3, and contribute patches and features! This document shows how to download, set up, build, and run the latest development version from the sources. (As of Spring 2010, we are in alpha.) These instructions work in NetBeans IDE 6 or better.

Note: In the following, always replace "~" with the path to your home directory.

Downloading the Sources

Check out the sources from the repository. (The following NetBeans instructions are equivalent to executing cd ~/NetBeansProjects; svn checkout http://jmonkeyengine.googlecode.com/svn/trunk/engine jme3 on the commandline.)

  1. In NetBeans go to Team > Subversion > Checkout
    1. You can leave user/pw blank for anonymous access.
  2. Click Next
    1. Repository Folders: trunk/engine
    2. Enable the checkbox to Skip "engine" and only checkout its contents.
    3. Local Folder: ~/NetBeansProjects/jme3
  3. Click Finish and wait.

The jme3 project opens in the Project window. It already includes a working ANT build script for building and running.

Look into the Libraries node and confirm that the project depends on the following libraries in the classpath:

jME3-natives-joal.jar	lwjgl.jar       gluegen-rt.jar
jME3-lwjgl-natives.jar	jinput.jar	swing-layout-1.0.4.jar
j-ogg-oggd.jar	        vecmath.jar     stack-alloc.jar
j-ogg-vorbisd.jar       asm-all-3.1.jar jbullet.jar
jheora-jst-debug-0.6.0.jar              xmlpull.xpp3-1.1.4c.jar
nifty*.jar                              eventbus-1.4.jar

Optional: Setting up Android Support

Work in progress …

A jme3 application can either be deployed to the desktop (as Java Swing application) and web browser (as JNLP/WebStart or Applet), or to an Android phone. While the former is the default, switching to Android deployment can be done in a few steps.

  1. Open Project Properties, go to Sources category.
  2. At Source Packages Folders, click "Add Folder".
    • Add src/android/
    • Remove src/desktop
    • Remove src/desktop_fx
  3. build.xml…

Build and Run

That's it!

  1. Right-click the jme3 project node and "Clean and Build" the project.
  2. In the Projects window, browse to the src/test/jme3test folder.
  3. Right-click e.g. the file src/test/jme3test/model/TestHoverTank.java and choose "Run" to run a sample.
    1. In the sample application, use the mouse and the AWSD keys to move around the test object.
    2. Press escape to quit the sample application.

Sample code for cool features is in the src/test/jme3test folder. A sample game can be found in src/games/jme3game/cubefield/CubeField.java.

Tips:

Optional: Javadoc Popups and Source Navigation in NetBeans

If you are working on the jme3 sources:

  1. In the Projects window, right-click the jme3 project and choose Generate Javadoc. Wait.
  2. Confirm in the Files window that the javadoc has been created in ~/NetBeansProjects/jme3/dist/javadoc
  3. In the editor, place the caret in a jme class and press ctrl-space to view javadoc.

If you are working on a game project that depends on jme3:

  1. First follow the previous tip. (In the future, we may offer jme javadoc as download instead.)
  2. In your game project, right-click the Libraries node and choose "Properties".
  3. In the Library properties, select jme3.jar and click the Edit button.
    1. For the Javadoc field, browse to ~/NetBeansProjects/jme3/dist/javadoc. Check "as relative path" and click select.
    2. For the Sources field, browse to ~/NetBeansProjects/jme3/src. Check "as relative path" and click select.
    3. Click OK.
  4. In the editor, place the caret in a jme class and press ctrl-space to view javadoc. Ctrl-click any jme3 method to jump to its definition in the sources.

This tip works for any third-party JAR library that you use. (You may have to download the javadoc/sources from their home page separately).


Sources used: BuildJme3, netbeans tutorial from forum

view online version