Starting new application, is it possible?

Hi all!

I’ve got a problem. I’am working on a program, which is based on JME.

It’s a kind of frontend, where you can pick a game and start it. This frontend is a SimpleApplication, and a game

can be anything, for example another SimpleApplication.

I know i can’t run multiple instances of them in the same JVM, so i decided to shut down the frontend

while the current game is running.

My question, is there a way to be sure that the application is closed, and another can be started?

Is it possible to stop a SimpleApplication and start another one in the same program?

If i call stop() then sleep about 10 seconds then there is no problem usually, but these isn’t the

way i’am looking for.

Sorry for my bad english, i’am hungarian! :slight_smile:

Looking forward to hear the answer!


Just use app.stop() and override app.destroy() to know when its actually shut down.

I’ll try it right now! Thanks for the answer!!!

It is not seems to be working.

I overrid the destroy() method, but when i start the second application it crashes. :frowning:

Is there another solution?

just make sure you call super.destroy() before you start the other app.

I call it.



public void destroy(){





This notifier class has a perform() method, which is called when the alert() method is invoked.

The notifier is a field of my main class that holds the SimpleApplication frontend, in the perform()

method I instantiate the new application and start it. It’s really fast tough, as tha frontend closed

the new is opened instantly, it goes for about 1 second then crashes.

Any ideas? :frowning:

Does the second app start normally? How are you starting the second app? Is it a new Java instance or the same Java instance?

It is the same java program, the other application is another instance of SimpleApplication, so it is in the same JVM.

If i stop the first, then sleep about 10 seconds and start the other, it starts normally, but only if the first is not in fullscreen. :S

Up up up! :slight_smile:

Any ideas on how to shut down a SimpleApplication and start a new one? :frowning:

It takes some indeterminate amount of time for the first app to shutdown. You might want to rethink your approach.

So there is no way to determine if a SimpleApplication has been sucessfully shut down?

I think about watching threads running or something like that…?