Time for action – distributing a game

During the development phase, you typically build and run your game right from the jMonkeyEngine SDK. Your users, however, neither have nor want the SDK. They expect to run the game by, for instance, executing a desktop application that runs on their Java Virtual Machine.

Switch to the Files window, and look into the dist folder. Every time you Build this project, the SDK generates an executable JAR file here. When you right-click on the project and choose Clean, the dist folder is deleted—so remember never to move any unique files there.

Let's go through the basic deployment process together:

  1. Right-click on the BasicGame project in SDK, and open the project's Properties window.
  2. Go to the Application | Desktop pane and select the checkboxes for your target operating systems, for example Windows, Mac, and Linux. Click on OK.
  3. Right-click on the BasicGame project, and Clean and Build it.

Look into the Output window to follow the build process.

What just happened?

When the build is finished, switch to your operating system's file explorer:

  1. Browse to the jMonkeyProjects/BasicGame/dist/ folder in your user home.
  2. Unzip and run the BasicGame executable for your operating system.
  3. The application window opens and displays the blue cube demo. Press the Esc key to quit.

This exercise shows you that the SDK generates distributable builds of your BasicGame project that runs fine on your desktop, outside the jMonkeyEngine SDK.

Impressive—you have just built a basic 3D application that runs on the three most widely used operating systems. Notice how you didn't have to configure any CLASSPATH or library paths.