Requirements

To finish this tutorial you will need:

  • NetBeans and the JDK. (download here, or here and find the latest version. Remember, you need JDK too.)
  • An SVN client

Source Download

Prepare Directories

We will be installing the sources into the following directory structure:

jME2/jME2
jME2/jME2Physics

where jME2/jME2 holds the sources for jME2, and jME2/jME2Physics holds the sources for jME2Physics.

Windows

<Create a new folder called jME2>
<Double click on the new folder>
<Create a new folder called jME2>
<Create a new folder called jME2Physics>

Linux

mkdir jME2
cd jME2
mkdir jME2
mkdir jME2Physics

Checkout jME2 from SVN

  • Start NetBeans.
  • Select Versioning → Checkout from the menu.
  • In Repository URL, use
http://jmonkeyengine.googlecode.com/svn/trunk/
  • Click Next.

  • Repository Folders should be set to trunk.
  • Select Skip trunk and checkout only its content.
  • Specify your jME2/jME2 location for Local Folder
  • Click Finish

Checkout jME2Physics from SVN

  • Select Versioning → Checkout from the menu.
  • In Repository URL, use
http://jmephysics.googlecode.com/svn/trunk
  • Click Next.

  • Repository Folders should be set to trunk.
  • Select Skip trunk and checkout only its content.
  • Specify your jME2/jME2Physics location for Local Folder
  • Click Finish

jME2 Compilation

Now that the sources have been downloaded, we need to compile them. Fortunately, jME comes with its own Ant scripts, which will perform the build steps for you.

Create a New Project

  • Create a new project in NetBeans, selecting a Java free-form project.
  • Set the location to your jME2/jME2 folder containing the SVN files.
  • Name it something if it hasn't already, and click next until you get to a finish button and create your project by pressing the finish button.

Compile Sources

Now we compile the project, test it, and generate Javadoc.

  • Right click jME2 project → Click Clean and build.
  • Right click jME2 project → Click Test the project.
  • Right click jME2 project → Click Generate Javadoc.
  • Right click jME2 project → Click Run.

It is OK if you see warnings, although errors are a problem.

Create the Libraries

jME2-Compile Library

  • Go to Tools>Libraries.
  • Click new library, and call this jME2-Compile.
  • Select the Classpath tab. Click “Add JAR/Folder”.
  • Go to your jME2 SVN. Select the build folder and confirm.
  • Select the Source tab. Click “Add JAR/Folder”.
  • Go to your jME2 SVN. Select the src folder and confirm.
  • Select the JavaDoc tab. Click “Add JAR/Folder”.
  • Go to your jME2 SVN. Select the data/doc folder and confirm.

jME2-Run Library

  • Click new Library, like we did at the very beginning of this step.
  • Call it jME2-Run.
  • Click “Add JAR/Folder”.
  • Go to lib folder inside JME2 project.
  • Select and add every .jar files you see (Java Executable Files) inside lib and subdirectories. If you use Linux, you don't have to add the .jar files on Linux and the same for Windows user, and so on. Jar files ARE actually folders. That's something beginners don't know. But make sure you added every .jar you have inside lib and subdirectories inside. (For me, now on December 2008, i have 9 when i end up, using Windows, if it helps). Make sure you have done this correctly, it's important.
  • Confirm.

jME2Physics Compilation

Compile Sources

  • Create a new Java Application project and do not create a Main class for it. Call it jME2Physics.
  • Left click on the project and select properties.
  • Go to the sources category.
  • Click add folder → Go to your jME2Physics SVN and multi-select src, test, test-interactive, and tutorial folders.
  • Click add folder → Add impl/ode/src folder (again in your jME2Physics SVN folder).
  • Go to the libraries category
  • Select the compile tab on the right.
  • Click add library → select jME-Compile. Confirm.
  • Select “Add JAR/Folder” → Go to your jME Physics 2 SVN and select ant/lib/junit.jar. Confirm.
  • Select “Add JAR/Folder” again → Go to your jME Physics 2 SVN and select impl/ode/lib/odejava-jni.jar. Confirm.
  • Select the run tab.
  • Click add library → select jME-run.
  • Select run category on the left.
  • Set the VM OPTIONS to:

Windows

-Djava.library.path="**ThePathTojME2**\jME2\lib\lwjgl\native\windows";"**ThePathToJme2PhysicsSVN**\impl\ode\lib"

Linux

-Djava.library.path="**ThePathTojME2**/jME2/lib/lwjgl/native/linux":"**ThePathToJme2PhysicsSVN**/impl/ode/lib"

Don't forget to change the beginning of the path to your own path and check it is ok and the files are there. This uses to be the core of general compilation or execution errors if you are not fluent with Java or programming or anything works so be careful with this. (Native Library Explanation)

  • Confirm Project Properties.
  • Right click on jME2Physics project → Click Build Project.
  • Right click on jME2Physics project → Click Generate Javadoc.

If you saw build successful for both of these congratulations. If jME2Physics compilation failed, make sure the quotes are right and you followed the step accordingly. If it still fails, please refer to the forums.

Create the Libraries

jME2Physics-Compile Library

  • Go to Tools>Libraries.
  • Create a new library called jME2Physics-Compile.
  • Select Classpath, then click “Add JAR/Folder”.
  • Go to the jME Physics 2 project folder you created and go to the dist directory. Add jME-Physics_2.jar. (or whatever the name of the project you created for physics was). Confirm.
  • Then select Sources, click “Add JAR/Folder”.
  • Go to the jME Physics 2 SVN. Add the src folder (not the src in project folder but the SVN folder, which is different). Confirm.
  • Then select JavaDocs, click “Add JAR/Folder”.
  • Go to the jME Physics 2 SVN, and go to the dist directory. Add the javadoc folder. Confirm.

jME2Physics-Run Library

  • Then create a new library called jME2Physics-Run.
  • Select Classpath and press “Add JAR/Folder”.
  • Go to your jME Physics 2 SVN, and select impl/ode/lib. Add odejava-jni.jar. Confirm.

Project Setup

Now that we have created the jME2 and jME2Physics libraries, these can be used in your projects. In this section, we'll guide you through the process of creating a new project with the right libraries.

  • Create a normal Java Application project.
  • Right click your project → Click Properties.
  • Click Libraries at the left, and the Compile tab, at the right. Press add library.
  • Select jME2-Compile and jME2Physics-Compile. Confirm.
  • Then select the run tab. Press add library.
  • Select jME2-Run and jME2Physics-Run. Confirm.
  • Under Run, set the VM OPTIONS to:

Windows

-Djava.library.path="jME2\jME2\lib\lwjgl\native\windows";"jME2\jME2Physics\impl\ode\lib"

Linux

-Djava.library.path="jME2/jME2/lib/lwjgl/native/linux":"jME2/jME2Physics/impl/ode/lib"

Where jME2/jME2 is the path to jME 2's SVN and jME2\jME2Physics is the path to jME Physics 2's SVN. (Native Library Explanation)

Now your project should be ready to work with.

Native Libraries Explanation

*These libraries (and the ones added to the jME-Physics2 project) are the 'native' libraries; basically they allow Java to tap directly into your hardware (ie. Video Card) and/or to run assembly (direct CPU) instructions. The libraries are loaded at run-time (when application starts up) and every project that uses jME (and/or jME-Physics) will have to be 'told' where these libraries are by use of the library path statement.


/var/www/wiki/data/pages/setting_up_netbeans_6.1_for_jme_2.0.txt · Last modified: 2009/10/16 01:46 by drgnak  
Recent changes · Show pagesource · Login

Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki

subscribe to jME latest jme headlines


site design by bleedcrimson designs © 2008