Setting up JME3 in Netbeans 8.x
For development with the jMonkeyEngine 3, we recommend to use the jMonkeyEngine SDK.
Alternatively, you can use your favorite IDE: In this tutorial we show how to download and set up the latest nightly build of the jMonkeyEngine 3 for use with the NetBeans IDE. Instructions for Eclipse are also available.
|
Note that the jMonkeyEngine SDK is built in top of the NetBeans Platform, and is identical to the NetBeans IDE for Java (plus some unique NetBeans plugins). Basically it’s redundant and unnecessary to set up jME for NetBeans – but if you want to, it’s easily possible. |
Downloading jME3
The currently available JAR binaries are the nightly builds.
-
Download the most recent zipped build from https://github.com/jMonkeyEngine/jmonkeyengine/releases
-
Unzip the file and save it as
jME3.2-stablein your NetBeansProjects directory. You should see the following files and directories:-
lib/- The jMonkeyEngine binaries and libraries. (Don’t remove.) -
jMonkeyEngine3.jar– Run this executable jar file to see various feature demos. (optional) -
javadoc/- jME3 API documentation. (optional) -
sources/- jME3 source files. (optional)
-
Creating a Project
In NetBeans, choose , select , click Next.
-
Project Name: HelloJME3
-
Project Location: ~/NetBeansProjects
-
Create main() Class: Yes
-
Click Finish
The new project appears in the Projects window.
Setting up Dependencies
Your project depends on the jMonkeyEngine libraries and needs to know where they are. We will create a global library so you can use it for other projects without having to re-configure everything. You only do this one time.
-
In the Projects window of the HelloJME3 project, RMB click the project’s
Librariesnode and chooseAdd Library. -
In the
Add Librarydialog, click the Create button. -
For the
Library Nameenter “jME3.2-stable”. -
For the
Library TypeselectClass Libraries. -
Click OK and the
Customize Librarydialog will open. -
In the
Classpathtab, click the Add Jar/Folder button and navigate to thelib/directory located in your~/NetBeansProjects/jME3.2-stablefolder. . Select all JARs inlib/and when done click the Add Jar/Folder button.-
Optional: Configuring the
Source Fileeditor for NetBeans.-
In the
Sourcestab, click the Add Jar/Folder button and navigate to thesources/directory located in your~/NetBeansProjects/jME3.2-stablefolder. ** Select all JARs insources/and when done click the Add Jar/Folder button.
-
-
Optional: Configuring the JavaDoc Popups in NetBeans.
-
In the
Javadoctab, click the Add ZIP/Folder button and navigate to thejavadoc/folder located in your~/NetBeansProjects/jME3.2-stablefolder. -
Select the
javadoc/folder but do not enter the directory, theFile Namewill change tojavadoc. Click the Add ZIP/Folder button to close the dialog.
-
-
-
Click the OK button, next click the Add Library to create the library.
The necessary libraries are now on the classpath and should appear in the Libraries list. You now have a global library you can add to any project.
|
If you configured your library with sources and javadocs, open a class of your HelloJME3 project, place the caret into a jme3 class, and press Ctrl + Space to see the javadoc popup, as well as code-completion. To open the source file editor, RMB click on any jME3 class or method, then select |
Build & Run Tips in NetBeans
How to build and run in NetBeans:
-
Clean and build the whole project by pressing Shift + F11.
-
Run any file that is open in the editor and has a main() class by pressing Shift + F6.
-
Run the Main class of the project by pressing F6.
Tips for configuring the main class in NetBeans:
-
RMB select the HelloJME3 project and choose “Set as main project”. Now you can use the toolbar buttons (clean&build, run, debug, etc) to control this project.
-
RMB select the HelloJME3 project and choose
Properties. Go to theRunsection.-
Under Main Class, specify the class that will be executed when you run the whole project. For now, enter
hellojme3.HelloJME3.
-
Writing a SimpleApplication
You can now continue to write your first jme3 application!