!!!初学者求助!!!多谢!!!
请问大侠:我在安装完jsdk1.3和 J2MEWTK之后,设置好了环境变量,可以正常编译以前写的java程序,可为什么编译不了现在j2me的程序。
例如:HelloWorld.java
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class HelloWorld extends MIDlet implements CommandListener{
private Display display;
private TextBox mainScreen=null;
private Command exit;
public HelloWorld(){
display=Display.getDisplay(this);
mainScreen=new TextBox("HelloWorld","Hello World",512,0);
exit=new Command("exit",Command.EXIT,2);
mainScreen.addCommand(exit);
mainScreen.setCommandListener(this);
}
public void atartApp(){
display.setCurrent(mainScreen);
}
public void pauseApp(){
}
public void destroyApp(boolean unconditional){
}
public void commandAction(Command c,Displayable s){
if(c==exit){
destroyApp(false);
notifyDestroyed();
}
}
}
编译错误:
HelloWorld.java:1: package javax.microedition.midlet does not exist
import javax.microedition.midlet.*;
^
HelloWorld.java:2: package javax.microedition.lcdui does not exist
import javax.microedition.lcdui.*;
^
HelloWorld.java:3: cannot resolve symbol
symbol : class MIDlet
location: class HelloWorld
public class HelloWorld extends MIDlet implements CommandListener{
^
HelloWorld.java:3: cannot resolve symbol
symbol : class CommandListener
location: class HelloWorld
public class HelloWorld extends MIDlet implements CommandListener{
^
HelloWorld.java:4: cannot resolve symbol
symbol : class Display
location: class HelloWorld
private Display display;
^
HelloWorld.java:5: cannot resolve symbol
symbol : class TextBox
location: class HelloWorld
private TextBox mainScreen=null;
^
HelloWorld.java:6: cannot resolve symbol
symbol : class Command
location: class HelloWorld
private Command exit;
^
HelloWorld.java:24: cannot resolve symbol
symbol : class Command
location: class HelloWorld
public void commandAction(Command c,Displayable s){
^
HelloWorld.java:24: cannot resolve symbol
symbol : class Displayable
location: class HelloWorld
public void commandAction(Command c,Displayable s){
^
HelloWorld.java:9: cannot resolve symbol
symbol : variable Display
location: class HelloWorld
display=Display.getDisplay(this);
^
HelloWorld.java:10: cannot resolve symbol
symbol : class TextBox
location: class HelloWorld
mainScreen=new TextBox("HelloWorld","Hello World",512,0);
^
HelloWorld.java:11: cannot resolve symbol
symbol : class Command
location: class HelloWorld
exit=new Command("exit",Command.EXIT,2);
^
HelloWorld.java:11: cannot resolve symbol
symbol : variable Command
location: class HelloWorld
exit=new Command("exit",Command.EXIT,2);
^
HelloWorld.java:27: cannot resolve symbol
symbol : method notifyDestroyed ()
location: class HelloWorld
notifyDestroyed();
^
14 errors