Time for action – starting the application

In the main() method of the class, you need to create a new instance of the application and call its start() method. In this case, the main class is called Main, but you can also name it MyGame or whatever you like:

public static void main(String[] args) {
  Main app = new Main();
  app.start();
}

When you run this code, the application window opens and the jMonkeyEngine starts rendering the scene.

What just happened?

Every jMonkeyEngine application provides the following methods for starting and stopping the game:

app.start();

This method starts a jME3 game, typically used from the main() class. It opens a window, initializes and draws the scene, and starts the event loop.

app.restart();

This method ...

Get jMonkeyEngine 3.0 Beginner's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.