What steps will reproduce the problem?
1. Do some J2ME code like:
// check for supported MIDP version
String supportedMidpProfile = System.getProperty("microedition.profiles");
if (supportedMidpProfile.indexOf("MIDP-2.") == -1) {
// if MIDP 2.0 is not supported, then the application will not run
utilObj.log("MIDP 2.0 not supported by the device.\n" +
applicationName + " will not run correctly !");
Thread.sleep(3000);
}
(or download from e.g. http://dictionarymid.sourceforge.net/dict.html)
2. Run in microemulator (web start). Runs OK
3. Save for web
4. Run as applet.
java.lang.NullPointerException applears in when calling
supportedMidpProfile.indexOf("MIDP-2.")
What is the expected output? What do you see instead?
According to
http://developers.sun.com/mobility/midp/questions/properties/index.html
there are some properties that developers can trust are always defined.
Microemu returns null in all cases when running as an applet.
What version of the product are you using? On what operating system?
Irrelevant
Please provide any additional information below.
See
https://code.google.com/p/microemu/source/browse/trunk/microemulator/microem
u-injected/src/main/java/org/microemu/Injected.java
Please change
public static String getProperty(String key) {
try {
return System.getProperty(key);
} catch (SecurityException e) {
return null;
}
}
to something like
public static String getProperty(String key) {
String value;
try {
value = System.getProperty(key);
} catch (SecurityException e) {
value = null;
}
if (value != null) return value;
if ("microedition.encoding".equals(key)) return
"ISO8859_1";
if ("microedition.configuration".equals(key)) return "CLDC-
1.0";
if ("microedition.profiles".equals(key)) return "MIDP-2.0";
... (etc)
return null;
}
Thanks,
Jacob
In Applet the different class is executed (the same name though) microemu-javase/src/main/java/org/microemu/Injected.java Method bode is different: public static String getProperty(String key) { return MIDletSystemProperties.getProperty(key); } In MIDletSystemProperties I have added though the requested properties.Labels: Milestone-3.0