- 论坛徽章:
- 0
|
By Richard Marejka, November 2005
E-mail
Print-friendly Version
Download
-->
-->
Question
What are the defined J2ME system property names?
-->
Answer
The various J2ME JSR documents define system property names that can be queried at runtime. These provide two services:
- To indicate the availability of an optional package:
For example, if the device supports the Location API for J2ME then the property microedition.location.version will be present. The value associated with it will be "1.0", to indicate compliance with JSR 179.
- To provide platform-dependent configuration data
For instance, the property microedition.commports is present in the MIDP 2.0 specification. Its value is a comma-separated list of ports you can use to build a URL, which the Generic Connection Framework can in turn use to create a javax.microedition.io.CommConnection object.
To query system properties use java.lang.System.getProperty(), as in:
import java.lang.*;
String value;
String key = "microedition.pim.version";
value = System.getProperty( key );
...
This table lists the defined system properties, drawing them from JSRs that are in the public review, final ballot, or final state, as defined in the
Java Community Process
(JCP):
J2ME Defined System Properties
JSR
Property Name
Default Value¹
30
microedition.platform
null
microedition.encoding
ISO8859_1
microedition.configuration
CLDC-1.0
microedition.profiles
null
37
microedition.locale
null
microedition.profiles
MIDP-1.0
75
microedition.io.file.FileConnection.version
1.0
file.separator
(impl-dep)
microedition.pim.version
1.0
118
microedition.locale
null
microedition.profiles
MIDP-2.0
microedition.commports
(impl-dep)
microedition.hostname
(impl-dep)
120
wireless.messaging.sms.smsc
(impl-dep)
139
microedition.platform
(impl-dep)
microedition.encoding
ISO8859-1
microedition.configuration
CLDC-1.1
microedition.profiles
(impl-dep)
177
microedition.smartcardslots
(impl-dep)
179
microedition.location.version
1.0
180
microedition.sip.version
1.0
184
microedition.m3g.version
1.0
185
microedition.jtwi.version
1.0
195
microedition.locale
(impl-dep)
microedition.profiles
IMP-1.0
205
wireless.messaging.sms.smsc
(impl-dep)
205
wireless.messaging.mms.mmsc
(impl-dep)
211
CHAPI-Version
1.0
¹(impl-dep) indicates that the default value is implementation-dependent.
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/38418/showart_298886.html |
|