We help IT Professionals succeed at work.
Get Started

Cannot create class in system package: help!

LornaJane
LornaJane asked
on
876 Views
Last Modified: 2013-11-24
I am working on a j2me application, and I can compile, preverify and jar everything fine.  However the emulator gives this error message:

Cannot create class in system package

I think this is a general java question rather than a midlet-related one, and I really hope one of you guys can help ... Java isn't really my area of expertes!  Here's the code:

import javax.microedition.lcdui.*;
import javax.microedition.lcdui.game.*;
import javax.microedition.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.addCommand(exitCommand);
            screenPic.setCommandListener(this);
    }

      protected void startApp()
      {
            System.out.println("starting application");
      }

      protected void pauseApp()
      {
      }

      protected void destroyApp(boolean b)
      {
      }

      public void commandAction(Command c, Displayable d)
      {
            if(c == exitCommand) notifyDestroyed();
      }

}

public class ScreenPic extends GameCanvas
{
      Image image;
      Byte imageData;

       public ScreenPic()
      {
            super(true);
            byte[] imageData = new byte[(int)5120*5120];
            image.createImage(imageData, 0, imageData.length);
      }

}
Comment
Watch Question
This problem has been solved!
Unlock 1 Answer and 12 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE