Deployment from JME 3.1 SDK


I have just finished with my first tutorial in JME 3.1 SDK. I love it a lot. Currently, I have to run my tutorial by right clicking on the project and choosing “Run” from the pop up menu. I tried executing my tutorial by using the commands below, but they did not work.

$ cd /home/erick/NetBeansProjects/MonkeyBlaster Source/MonkeyBlaster_Tutorial_Part5/build/classes/monkeyblaster
$ java MonkeyBlasterMain.class
This would give me “Error: Could not find or load main class MonkeyBlasterMain.class”.
$ java ./MonkeyBlasterMain.class
This would also give me “Error: Could not find or load main class …MonkeyBlasterMain.class”.
$ java -cp . MonkeyBlasterMain.class
Error: Could not find or load main class MonkeyBlasterMain.class

My two questions are below.

  1. How do I execute my tutorial from the command line?
  2. One day, if I am successful in writing JME games, what is the best way to package my games or this tutorial to customers professionally?

The image below is captured from executing the tutorial from within the SDK.


Thank you so much.

First… none of those are using the correct class name because I guarantee you it has a package… and if it doesn’t then it’s just wrong anyway.

But even given that, running it without the proper classpath (all of the jars, etc.) won’t run it anyway.

Configure your project to have “Desktop deployment” setup and then build that. Then you can use that to run it from the command line. Else the command line to run manually will be very long.

Hello and nice work!

  1. If you made it with the IDE then it should made a compiled jar for you. Just go to the folder or directory to where the built jar is located and run.
    java -jar <your compiled jar>.jar

  2. There are different ways to package your JME. I can list them here to what I consider, from the easiest to “hardest” in complexity of the ones I have used.
    a. if you made the game using the JMonkeyEngineSDK, the IDE makes it easy to make executable for each platform from one location and the options are right there for you. it packages the game along with the jre
    b. The one I use is core Netbeans because it is like the middleground and for each desktop platform it can make a really robust build for executables (I have a Mac, PC and Linux machines where I test and make custom stuff that each app store may need).
    c. launch4j is pretty good as well and can help you set up what you need but you need to learn well how it works and what you should do, but once you master it it will help you have app store applications ready to distribute to anyone

Thank you so much. The core Netbeans one sounds good.