I've not done very much Java before and now I'm working on a j2me
application, however I think the trouble I have is generic java. I
can compile, preverify and jar everything fine, but the emulator
crashes with the error message:
Cannot create class in system package
My code (in its entirety!) follows:
import javax.microedit ion.lcdui.*;
import javax.microedit ion.lcdui.game. *;
import javax.microedit ion.midlet.*;
import java.io.*;
public class hello extends MIDlet implements CommandListener
{
Command exitCommand = new Command("exit", Command.EXIT, 1);
ScreenPic screenPic;
public hello()
{
screenPic = new ScreenPic();
screenPic.addCo mmand(exitComma nd);
screenPic.setCo mmandListener(t his);
}
protected void startApp()
{
System.out.prin tln("starting application");
}
protected void pauseApp()
{
}
protected void destroyApp(bool ean b)
{
}
public void commandAction(C ommand c, Displayable d)
{
if(c == exitCommand) notifyDestroyed ();
}
}
class ScreenPic extends GameCanvas
{
Image image;
Byte imageData;
public ScreenPic()
{
super(true);
byte[] imageData = new byte[(int)5120*5120];
image.createIma ge(imageData, 0, imageData.lengt h);
}
}
Many thanks to anyone who can throw light on this one
application, however I think the trouble I have is generic java. I
can compile, preverify and jar everything fine, but the emulator
crashes with the error message:
Cannot create class in system package
My code (in its entirety!) follows:
import javax.microedit ion.lcdui.*;
import javax.microedit ion.lcdui.game. *;
import javax.microedit ion.midlet.*;
import java.io.*;
public class hello extends MIDlet implements CommandListener
{
Command exitCommand = new Command("exit", Command.EXIT, 1);
ScreenPic screenPic;
public hello()
{
screenPic = new ScreenPic();
screenPic.addCo mmand(exitComma nd);
screenPic.setCo mmandListener(t his);
}
protected void startApp()
{
System.out.prin tln("starting application");
}
protected void pauseApp()
{
}
protected void destroyApp(bool ean b)
{
}
public void commandAction(C ommand c, Displayable d)
{
if(c == exitCommand) notifyDestroyed ();
}
}
class ScreenPic extends GameCanvas
{
Image image;
Byte imageData;
public ScreenPic()
{
super(true);
byte[] imageData = new byte[(int)5120*5120];
image.createIma ge(imageData, 0, imageData.lengt h);
}
}
Many thanks to anyone who can throw light on this one