Hi all,
I'm trying to get a REALLY simple HelloWorld app using LWUIT up and running, and I'm using the latest Eclipse IDE.
Great news is it compiles and runs, bad news is it completely refuses to load and use any theme file (.res) I supply and I have no idea why - so I'm just getting an unthemed (black and white) LWUIT app.
Error I am getting at runtime is:
Installing suite from: http://127.0.0.1:54445/HelloLWUIT.jad
****warning****
****Untrusted user classes must never be put
****on the system class path
****warning****
java.lang.NullPointerException: 0
- java.io.DataInputStream.read(), bci=4
- java.io.DataInputStream.readUnsignedShort(), bci=1
- java.io.DataInputStream.readShort(), bci=1
- com.sun.lwuit.util.Resources.openFile(), bci=20
- com.sun.lwuit.util.Resources.<init>(), bci=28
- com.sun.lwuit.util.Resources.open(), bci=16
- HelloLWUITMIDlet.startApp(), bci=6
- javax.microedition.midlet.MIDletTunnelImpl.callStartApp(), bci=1
- com.sun.midp.midlet.MIDletPeer.startApp(), bci=7
- com.sun.midp.midlet.MIDletStateHandler.startSuite(), bci=269
- com.sun.midp.main.AbstractMIDletSuiteLoader.startSuite(), bci=52
- com.sun.midp.main.CldcMIDletSuiteLoader.startSuite(), bci=8
- com.sun.midp.main.AbstractMIDletSuiteLoader.runMIDletSuite(), bci=161
- com.sun.midp.main.AppIsolateMIDletSuiteLoader.main(), bci=26
The important line being: - HelloLWUITMIDlet.startApp(), bci=6
which when clicked hilights this line in my source:
Resources r = Resources.open("themes2/test.res");
That file (test.res) is showing correctly (I think?) in the Package Explorer heirarchy. To get it in there, I went to my project's properties in Eclipse, then Java Build Path->Source tab->Add folder, then added 'themes2' and right clicked 'themes2' in the hierarchy back in package explorer and hit 'refresh' so that it showed up the .res file in the hierarchy too.
I've no idea why I'm getting the untrusted user classes warning at the top, and whether this is related to the theme not loading. When adding the LWUIT.jar in the first place, I again brought up my project's settings->Java Build Path->Libraries tab->Add External JARs... and then LWUIT.jar showed up in Package Explorer under my project, under 'Referenced Libraries' folder.
I REALLY need some help PLEASE, am completely stuck!
Relevant source code is:
public void startApp() {
Display.init(this);
try {
Resources r = Resources.open("themes2/test.res");
UIManager.getInstance().setThemeProps(r.getTheme("test"));
} catch (IOException ioe) {
// Do something here.
}
Form f = new Form("Hello, LWUIT!");
f.show();
etc....
Many thanks,
Alex

Reply With Quote

