Symbian
Symbian OS Library

FAQ-0270 Isn't it possible to run two Java apps or midlets at the same time in the emulator?

[Index][spacer] [Previous] [Next]



 

Classification: Java Category: Emulator
Created: 09/14/99 Modified: 11/07/2002
Number: FAQ-0270
Platform: ER5, Symbian OS v6.0, Symbian OS v7.0

Question:
When I try to launch a second Java app in the emulator, it always fails. In the error console I am informed which classpath was set, but offered no other information. What's going on?

Answer:
The short answer is: No, you can't run two Java apps simultaneously in the one emulator session.
On the Symbian WINS emulator, multiple Java Virtual Machines cannot run simultaneously. When a Java application starts up, it loads (p)javai.dll, and starts up the Java VM. Because the emulator is single process, a second Java application cannot then load another instance of that DLL. Instead, it will attempt to share the global variables associated with the existing DLL instance. Unlike with native applications, the Java DLLs are not designed to be re-entrant in this manner, so this will fail. No work around is currently known.

(In the case of J2ME MIDP the one exception to the rule is if the two midlets are in the same suite. In this case they both run in the same Virtual Machine instance).

There is, however, no problem with separate instances of the emulator both running Java apps (or midlets), because the two emulators run as separate processes.

On a target Symbian device, which supports multiple processes, more than one instance of the Java VM can be loaded simultaneously from a single instance of (p)javai.dll in ROM or RAM. The only restriction is the amount of RAM available.