For development with the jMonkeyEngine 3, use the jMonkeyEngine SDK that you can download for free from http://jmonkeyengine.org.
If you want to use your favorite IDE for coding, you can create a code-less jMonkeyEngine project. This makes it possible to use the asset management tools in the SDK, even if you do not use the SDK's code editor. At the same time, you can manage the source code and build a script in Eclipse (or any other IDE).
Since the SDK is built on top of the NetBeans platform, users of NetBeans IDE should feel right at home. In the following tutorial, we show how to download and set up the latest nightly build of the jMonkeyEngine 3 library for use with the Eclipse IDE.
You can find the most current Eclipse setup tips at http://jmonkeyengine.org/wiki/doku.php/jme3:setting_up_jme3_in_eclipse.
The currently available JAR binaries are the nightly builds.
The nightly build contains the jMonkeyEngine binaries as JAR files. Download the most recent zipped build from http://nightly.jmonkeyengine.com.
Unzip the file and save the directory as
jME3_2013-xx-xx
in your home directory ($HOME
).Verify that you have at least the following files and directories:
lib/
andopt/
: The jMonkeyEngine binaries, and libraries used by the jMonkeyEngine (don't remove)jMonkeyEngine.jar
: Run this file to see various feature demos (optional)javadoc/
: jME3 API documentation (optional but useful)source/
: The jMonkeyEngine library's source code (optional but useful)
Open the Eclipse IDE.
Choose File | New | Java Project.
Enter the Project Name; for example,
HelloJME3
.Click on Finish.
The new Java project appears in the Eclipse Explorer.
Your project depends on the jMonkeyEngine libraries, so it needs to know where they are.
Right-click on the project in the Eclipse Explorer and choose Build Path | Add External Archives.
In the JAR selection dialog, browse to the
$HOME/jME3_2013-xx-xx
directory.Select all JARs in the
lib
directory and click on Open.
All necessary JAR libraries are now on the classpath and should appear in the Referenced Libraries list.
The jMonkeyEngine SDK creates an assets folder for your projects. In Eclipse, perform the following steps manually:
On the top level of your Eclipse project, create a new directory and name it
assets
. Save all your game assets into this folder.In the jMonkeyEngine SDK, choose File | Import Project | External Project Assets from the menu to open the Import External Project Assets wizard.
When the wizard asks for a project folder, browse to your Eclipse project's top-level folder.
When the wizard asks for an assets folder, browse to your Eclipse project's assets folder. Click on Next and then on Finish.
A so-called codeless jMonkeyEngine project gets saved into your Eclipse project. The project also appears in the jMonkeyEngine's Projects window. You use this project to create materials, convert 3D models, and so on.
In the Eclipse IDE, you write your code as you are used to.
From the menu, open File | New | New Package. Name the package for example
hello
.From the menu, open File | New | Class.
Select package
hello
.Name the class; for example,
MyGame
.Specify the Superclass as
com.jme3.app.SimpleApplication
.Activate the checkbox to create the
main()
method if this is the main class of your game.Activate the checkbox for Inheriting Abstract Methods.
Click on Finish.
The new main class based on SimpleApplication opens in the editor. Write your game code, or copy and paste one of the tutorials.
Consult the Eclipse documentation for advice on compiling and deploying your game.