Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

How to read system properties in Java ME

From Wiki
Jump to: navigation, search
Article Metadata
Code ExampleCompatibilityArticle
Created: jarmlaht (25 May 2010)
Last edited: hamishwillee (22 Jul 2013)



In Java ME there is a System.getProperty() method for getting information about certain system properties. The method is used by giving a key String as a parameter and the method returns the value of the key. For example, the key "microedition.platform" returns the device name and firmware version of the Nokia device. On Symbian platform, the latest S60 5th Edition and Symbian devices return also information about the version of the Java Runtime in the device.

// returns "NokiaN97-1/30.0.010/sw_platform=S60;sw_platform_version=5.0;java_build_version=1.4.48" in Nokia N97
String platform = System.getProperty("microedition.platform");

Most of the optional Java ME APIs utilize this method by having a property key for showing the API version and other useful API information. In addition, Nokia devices provide commonly a plenty of Nokia-specific system properties. This wiki article introduces the SystemProperties MIDlet, which lists all the system properties currently (October 2011) used in Nokia devices. It is also possible to create a report of them in text file and HTML formats. The report is saved to device's memory, where it can be found and copied to later use on your PC.

Nokia303 1.png Nokia303 6.png        

SystemProperties MIDlet features

Update: SystemProperties 2.0

The SystemProperties MIDlet has been updated to version 2.0 and it provides system properties up to the latest devices of Nokia platforms including Series 40 platform devices with Java Runtime 1.0.0 for Series 40 and Symbian platform devices with Java Runtime 2.3 for Symbian.

The updates include the following:

  • Restructured the main menu. The optional APIs have been placed on the menu based on their JSR number (JSR-75, JSR-82, JSR-135,..). The 'Optional APIs' menu item has been removed from the menu, the version data from 'Optional APIs' have been placed under each optional API and will be shown as first system property data for each API.
  • Added the following main menu items:
  • MIDP, CLDC, JTWI, MSA: shows system properties for the core Java ME APIs.
  • Location API (JSR-179): shows system properties for Location API.
  • SIP API (JSR-180): shows system properties for SIP API.
  • Content Handler API (JSR-211): shows system properties for Content Handler API.
  • NFC API (JSR-257) & extensions: shows system properties for Near Field Communication (NFC) API and Nokia specific extensions to the NFC API.
  • Broadcast API (JSR-272): shows system properties for Mobile Broadcast Service API.
  • Nokia UI API: shows system properties for Nokia UI API.
  • All Nokia platforms: shows Nokia specific system properties which are currently (October 2011) supported by the latest devices of Nokia platforms with Java Runtime (more specifically, Series 40 platform devices with Java Runtime 1.0.0 for Series 40 and Symbian platform devices with Java Runtime 2.3 for Symbian. Some of the system properties have been introduced prior to the described Java Runtime releases, for more information about the introduction releases please see the up-to-date table of Nokia specific system properties on Java Developer's Library).
  • Series 40 platform: shows system properties which are supported by Series 40 platform devices.
  • Symbian platform: shows system properties which are supported by Symbian devices. From the 'Symbian platform' view, the Full Canvas specific system properties can be checked by selecting 'Full Canvas' from 'Options'.
    Nokia303 2.png
  • Removed S60 specific system properties (replaced by 'All Nokia platforms' and 'Symbian platform' system properties).
  • Added text file format for system properties report. Previously only HTML format has been supported for the reports.
  • Added notification on the save location for the generated report.
    Nokia303 3.pngNokia303 4.png
  • Added 'More info' item to the main menu (placed under 'Options'). The 'More info' includes links to Java Developer's Library which provides the latest up-to-date information regarding system properties and other Java ME features on Nokia devices. Includes the direct link ('Go to JDL') which allows end-user to browse directly to the library with a Nokia device.
    Nokia303 7.png
  • Updated the application by signing with a fresh trusted 3rd party certificate (VeriSign).

Symbian: Launching applications with parameters

The SystemProperties MIDlet can be used also for testing a new feature in Symbian^3 (with JRT 2.1) devices: launching MIDlet with parameters. In the zip package there is also another MIDlet included, CommandLineMIDlet. It can be used for launching the SystemProperties MIDlet with parameters, in this case with one parameter, "param1". Usage of this feature is described in more detail in JDL: Launching applications with parameters.

Using CommandLineMIDlet

The CommandLineMIDlet is a simple MIDlet for testing a new feature in JRT 2.1, launching MIDlets with parameters. Note, that this feature works only in Symbian^3 devices and newer, like Nokia N8. The MIDlet itself has a TextField for entering parameter for MIDlet.platformRequest() method. The method is used for launching SystemProperties MIDlet with an additional parameter "param1". The parameter "param1" gets and value of "hello!".

Install first the both MIDlets, SystemProperties and CommandLineMIDlet. Then launch CommandLineMIDlet, and select command "Launch". When the SystemProperties MIDlet is launched, there are some new properties under "Symbian^3 properties" category, which can be used:

"" for getting the command line parameters, in this case: "param1=hello!"
"" for getting the number, how many times the MIDlet has been relaunched, in this case 1
"param1" for getting the value of the parameter "param1", in this case "hello!"

Creating an HTML report of system properties

There is a "Create report" command in the SystemProperties MIDlet main screen. It creates and HTML file with tables containing the properties and their values. The file is saved to device's memory, commonly C:/Data/Images/ folder. The folder is actually got by using "" system property. Then it is opened by using MIDlet.platformRequest() method, file path as parameter. As result of this, the HTML file is opened in the device's web browser, as shown in the picture below.

Html report landscape.png

Example of an HTML report (Nokia N97 system properties)

Example application

See also

This page was last modified on 22 July 2013, at 11:39.
75 page views in the last 30 days.