编译OK,,但是运行保持,怎么回事呀?

Unable to create MIDlet HelloMidlet
java.lang.ClassNotFoundException: HelloMidlet
at com.sun.midp.midlet.MIDletState.createMIDlet(+29)
at com.sun.midp.midlet.Selector.run(+22) 


网上找到代码如下: 编译没有问题,,但是在虚拟机器上一运行,就报上面的错。怎么回事呢?


/*
 * HelloMidlet.java
  *
 * Created on 2007年1月26日, 下午12:34
 */
package hello;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
/**
 *
 * @author zhhz
 */
public class HelloMidlet extends MIDlet implements CommandListener {
    
    /** Creates a new instance of HelloMidlet */
    public HelloMidlet() {
    }
    
    private Form helloForm;                     
    private StringItem helloStringItem;
    private Command exitCommand;
    private Form form1;
    private Command exitCommand1;
    private ChoiceGroup choiceGroup1;
    private TextField textField1;
    private TextField textField2;
    private Command okCommand1;
    private Command cancelCommand1;
    private Command cancelCommand2;
    private Command okCommand2;
    private Command okCommand3;                   
    
                     
    /** This method initializes UI of the application.                        
     */
    private void initialize() {                      
        // Insert pre-init code here
        getDisplay().setCurrent(get_helloForm());                      
        // Insert post-init code here
    }                     
    
    /** Called by the system to indicate that a command has been invoked on a particular displayable.                      
     * @param command the Command that ws invoked
     * @param displayable the Displayable on which the command was invoked
     */
    public void commandAction(Command command, Displayable displayable) {                    
        // Insert global pre-action code here
        if (displayable == helloForm) {                     
            if (command == exitCommand) {                   
                // Insert pre-action code here
                getDisplay().setCurrent(get_form1());                       
                // Insert post-action code here
            }                      
        } else if (displayable == form1) {
            if (command == exitCommand1) {                    
                // Insert pre-action code here
                exitMIDlet();                       
                // Insert post-action code here
            } else if (command == okCommand3) {                     
               // = "/u8BF7/u8F93/u5165/u59D3/u540D/uFF1A"; // Insert pre-action code here
                // Do nothing                        
                // Insert post-action code here
            }                       
        }                     
        // Insert global post-action code here
}                   
    
    /**
     * This method should return an instance of the display.
     */
    public Display getDisplay() {                         
        return Display.getDisplay(this);
    }                        
    
    /**
     * This method should exit the midlet.
     */
    public void exitMIDlet() {                         
        getDisplay().setCurrent(null);
        destroyApp(true);
        notifyDestroyed();
    }                        
    
    /** This method returns instance for helloForm component and should be called instead of accessing helloForm field directly.                        
     * @return Instance for helloForm component
     */
    public Form get_helloForm() {
        if (helloForm == null) {                      
            // Insert pre-init code here
            helloForm = new Form(null, new Item[] {                       
                get_helloStringItem(),
                get_choiceGroup1()
            });
            helloForm.addCommand(get_exitCommand());
            helloForm.setCommandListener(this);                     
            // Insert post-init code here
        }                      
        return helloForm;
    }                    
    
    /** This method returns instance for helloStringItem component and should be called instead of accessing helloStringItem field directly.                        
     * @return Instance for helloStringItem component
     */
    public StringItem get_helloStringItem() {
        if (helloStringItem == null) {                      
            // Insert pre-init code here
            helloStringItem = new StringItem("Hello", "Hello, World!");                      
            // Insert post-init code here
        }                      
        return helloStringItem;
    }                    
    
    /** This method returns instance for exitCommand component and should be called instead of accessing exitCommand field directly.                        
     * @return Instance for exitCommand component
     */
    public Command get_exitCommand() {
        if (exitCommand == null) {                      
            // Insert pre-init code here
            exitCommand = new Command("NEXT", Command.EXIT, 1);                      
            // Insert post-init code here
        }                      
        return exitCommand;
    }                    
    /** This method returns instance for form1 component and should be called instead of accessing form1 field directly.                        
     * @return Instance for form1 component
     */
    public Form get_form1() {
        if (form1 == null) {                      
            // Insert pre-init code here
            form1 = new Form(null, new Item[] {                       
                get_textField1(),
                get_textField2()
            });
            form1.addCommand(get_exitCommand1());
            form1.addCommand(get_okCommand3());
            form1.setCommandListener(this);                     
            // Insert post-init code here
        }                      
        return form1;
    }                    
    /** This method returns instance for exitCommand1 component and should be called instead of accessing exitCommand1 field directly.                        
     * @return Instance for exitCommand1 component
     */
    public Command get_exitCommand1() {
        if (exitCommand1 == null) {                      
            // Insert pre-init code here
            exitCommand1 = new Command("exit", Command.EXIT, 1);                      
            // Insert post-init code here
        }                      
        return exitCommand1;
    }                    
    /** This method returns instance for choiceGroup1 component and should be called instead of accessing choiceGroup1 field directly.                         
     * @return Instance for choiceGroup1 component
     */
    public ChoiceGroup get_choiceGroup1() {
        if (choiceGroup1 == null) {                       
            // Insert pre-init code here
            choiceGroup1 = new ChoiceGroup("asdfasdfkasd;k f/ndsfasd/nf/nas/ndf/na/n/n", Choice.MULTIPLE, new String[0], new Image[0]);                        
            choiceGroup1.setSelectedFlags(new boolean[0]);                      
            // Insert post-init code here
        }                       
        return choiceGroup1;
    }                     
    /** This method returns instance for textField1 component and should be called instead of accessing textField1 field directly.                         
     * @return Instance for textField1 component
     */
    public TextField get_textField1() {
        if (textField1 == null) {                       
            // Insert pre-init code here
            textField1 = new TextField("/u8BF7/u8F93/u5165/u59D3/u540D/uFF1A", "", 120, TextField.ANY);                       
            // Insert post-init code here
        }                       
        return textField1;
    }                     
    /** This method returns instance for textField2 component and should be called instead of accessing textField2 field directly.                         
     * @return Instance for textField2 component
     */
    public TextField get_textField2() {
        if (textField2 == null) {                       
            // Insert pre-init code here
            textField2 = new TextField("/u8BF7/u8F93/u5165/u5BC6/u7801/uFF1A", null, 120, TextField.ANY);                       
            // Insert post-init code here
        }                       
        return textField2;
    }                     
    /** This method returns instance for okCommand1 component and should be called instead of accessing okCommand1 field directly.                         
     * @return Instance for okCommand1 component
     */
    public Command get_okCommand1() {
        if (okCommand1 == null) {                       
            // Insert pre-init code here
            okCommand1 = new Command("cancle", Command.OK, 1);                       
            // Insert post-init code here
        }                       
        return okCommand1;
    }                     
   
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
提供的源码资源涵盖了Java应用等多个领域,每个领域都包含了丰富的实例和项目。这些源码都是基于各自平台的最新技术和标准编写,确保了在对应环境下能够无缝运行。同时,源码中配备了详细的注释和文档,帮助用户快速理解代码结构和实现逻辑。 适用人群: 适合毕业设计、课程设计作业。这些源码资源特别适合大学生群体。无论你是计算机相关专业的学生,还是对其他领域编程感兴趣的学生,这些资源都能为你提供宝贵的学习和实践机会。通过学习和运行这些源码,你可以掌握各平台开发的基础知识,提升编程能力和项目实战经验。 使用场景及目标: 在学习阶段,你可以利用这些源码资源进行课程实践、课外项目或毕业设计。通过分析和运行源码,你将深入了解各平台开发的技术细节和最佳实践,逐步培养起自己的项目开发和问题解决能力。此外,在求职或创业过程中,具备跨平台开发能力的大学生将更具竞争力。 其他说明: 为了确保源码资源的可运行性和易用性,特别注意了以下几点:首先,每份源码都提供了详细的运行环境和依赖说明,确保用户能够轻松搭建起开发环境;其次,源码中的注释和文档都非常完善,方便用户快速上手和理解代码;最后,我会定期更新这些源码资源,以适应各平台技术的最新发展和市场需求。 所有源码均经过严格测试,可以直接运行,可以放心下载使用。有任何使用问题欢迎随时与博主沟通,第一时间进行解答!
提供的源码资源涵盖了小程序应用等多个领域,每个领域都包含了丰富的实例和项目。这些源码都是基于各自平台的最新技术和标准编写,确保了在对应环境下能够无缝运行。同时,源码中配备了详细的注释和文档,帮助用户快速理解代码结构和实现逻辑。 适用人群: 适合毕业设计、课程设计作业。这些源码资源特别适合大学生群体。无论你是计算机相关专业的学生,还是对其他领域编程感兴趣的学生,这些资源都能为你提供宝贵的学习和实践机会。通过学习和运行这些源码,你可以掌握各平台开发的基础知识,提升编程能力和项目实战经验。 使用场景及目标: 在学习阶段,你可以利用这些源码资源进行课程实践、课外项目或毕业设计。通过分析和运行源码,你将深入了解各平台开发的技术细节和最佳实践,逐步培养起自己的项目开发和问题解决能力。此外,在求职或创业过程中,具备跨平台开发能力的大学生将更具竞争力。 其他说明: 为了确保源码资源的可运行性和易用性,特别注意了以下几点:首先,每份源码都提供了详细的运行环境和依赖说明,确保用户能够轻松搭建起开发环境;其次,源码中的注释和文档都非常完善,方便用户快速上手和理解代码;最后,我会定期更新这些源码资源,以适应各平台技术的最新发展和市场需求。 所有源码均经过严格测试,可以直接运行,可以放心下载使用。有任何使用问题欢迎随时与博主沟通,第一时间进行解答!
提供的源码资源涵盖了Java应用等多个领域,每个领域都包含了丰富的实例和项目。这些源码都是基于各自平台的最新技术和标准编写,确保了在对应环境下能够无缝运行。同时,源码中配备了详细的注释和文档,帮助用户快速理解代码结构和实现逻辑。 适用人群: 适合毕业设计、课程设计作业。这些源码资源特别适合大学生群体。无论你是计算机相关专业的学生,还是对其他领域编程感兴趣的学生,这些资源都能为你提供宝贵的学习和实践机会。通过学习和运行这些源码,你可以掌握各平台开发的基础知识,提升编程能力和项目实战经验。 使用场景及目标: 在学习阶段,你可以利用这些源码资源进行课程实践、课外项目或毕业设计。通过分析和运行源码,你将深入了解各平台开发的技术细节和最佳实践,逐步培养起自己的项目开发和问题解决能力。此外,在求职或创业过程中,具备跨平台开发能力的大学生将更具竞争力。 其他说明: 为了确保源码资源的可运行性和易用性,特别注意了以下几点:首先,每份源码都提供了详细的运行环境和依赖说明,确保用户能够轻松搭建起开发环境;其次,源码中的注释和文档都非常完善,方便用户快速上手和理解代码;最后,我会定期更新这些源码资源,以适应各平台技术的最新发展和市场需求。 所有源码均经过严格测试,可以直接运行,可以放心下载使用。有任何使用问题欢迎随时与博主沟通,第一时间进行解答!

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值