Why are there Duplicate Methods in the Beginner Tutorial?


I just started out on the beginner tutorial:


Having completed it, I would to know why the method that sets up the the blue cube walk-through is duplicated. It appears in Main and in HelloJME3. Did I do something wrong? I feel I can’t proceed until I understand this.

Many thanks in advance.

Ummm. I’m not seeing what your’e talking about.

Cut and paste what you are seeing into a reply.

My guess… is that it tells him to create a simple game project which will already have its own Main class. The tutorial doesn’t tell you to delete the one that comes with the default project. Most people would know to do this automatically but very new developers won’t know this, I guess.


I see. Il clean it up.



Thanks for your replies and patience. In the very first tutorial, “Create a project” I complete these first steps:

1. Choose File→New Project… from the main menu.

2. In the New Project wizard, select the template JME3→Basic Game. Click Next.

3. Specify a project name, e.g. “HelloWorldTutorial

4. Specify a path where to store your new project, e.g. a jMonkeyProjects directory in your home directory.

5. Click Finish.

After that, the IDE shows the source code of the package mygame, and the class public class Main extends SimpleApplication {}

In that class is a method called public void simpleInitApp() which contains a few lines of code to set up the blue cube walkthrough:

After that the next tutorial is “Extend SimpleApplication”:

  1. In the jMonkeyEngine SDK:

  2. Right-click the Source Packages node of your project.

  3. Choose New…→Java Class to create a new file.

  4. Enter the class name: HelloJME3

  5. Enter the package name: jme3test.helloworld.

  6. Click Finish.

The SDK creates the file HelloJME3.java for you.

There is then a code sample to paste in which is in essence identical to the Main class mentioned above, but this package is called jme3test.helloworld with a class is called HelloJME3.

So when I get there, I have two different packages with the same content. I understand now (from pspeed) we are supposed to delete mygame (or replace the code in it). So I guess I was just confused by the approach because when I hit the run button in the editor, it was executing the Main class, not the HelloJM3. That meant changes I made to the scene parameters didn’t show.

Incidently, it did leave me wondering how one can set the main class when the are two classes with main methods…

In the project settings.

Any time you have to set something like that about the project it is likely in the project settings.

1 Like

Try it now.

1 Like

Thanks very much for that, and also for your great work with tutorials in general!