When writing j2me applications for cellphones, using System.out.println() prints on the console if using an emulator. However, when the code is deployed on a cellphone, where does the console output go?
If it is impossible to see this in the untethered cellphone, is there a way to see it if the cellphone is still connected to the deploying PC [via USB] ?
On Symbian phones (Nokia, Sony-Ericsson, Motorola, Samsung, Panasonic, Siemens, check for the Series60, Series80, Series90 or UIQ platforms), You can retrieve both System.out and System.err. Most importantly, you can retrieve Throwable.printStackTrace() as well.
Early versions of Symbian OS came with a native tool called Redirector. It ended up becoming available to third party MIDlet developers too. It might be hard to find these days but can be re-developed using C++ code that plugs into the Symbian implementation of the C standard library that the Java Virtual Machine uses.
Newer versions of Symbian OS come with an additional GCF protocol that allows retrieval of System.out, System.err and Throwable.printStackTrace() by simply using
javax.microedition.io.Connector.openDataInputStream("redirect://");
You may need to use "redirect://test" on some versions of Series60, during the transition from the Sun Ltd cldc-hi virtual machine to the IBM J9 virtual machine.
The connection needs to be opened before you launch the MIDlet whose output you want to log so you'll need to open it in a separate MIDlet.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With