Topic: 向大家请教J2SE5.0中APPLET小程序运行问题! |
Print this page |
1.向大家请教J2SE5.0中APPLET小程序运行问题! | Copy to clipboard |
Posted by: dazern Posted on: 2005-04-16 12:29 向大家请教J2SE5.0中APPLET小程序运行问题!真急死我了,弄来弄去就是不明白怎么回事! 我的问题情况如下: 1,下面是我的APPLET小程序原代码: package com.dazern.web; import java.applet.*; import java.awt.*; import java.awt.event.*; public class ClickMe extends Applet implements ActionListener{ private Button quit=new Button("quit"); private Button click=new Button("click me"); private TextField text=new TextField(10); private boolean secondClick=true; public void init(){ setLayout(new FlowLayout()); add(quit); add(click); add(text); quit.addActionListener(this); click.addActionListener(this); } public void start(){ text.setText("Applet started"); } public void stop(){ text.setText("Applet stopped"); } public void actionPerformed(ActionEvent e){ if(e.getSource()==quit) text.setText("Can not quit Applet"); else if(e.getSource()==click) { if(secondClick) text.setText("第一次点击!"); else text.setText("第二次点击!"); secondClick=!secondClick; } } } 2,下面是我的查看APPLET小程序的HTML文件代码: <html> <head><title>MyFistjavaapplet</title></head> <body> <hr> <Applet code=ClickMe width=500; height=500; </Applet> </body> </html> 3,我是在Jcreator 这个工具中进行编程调试的,小程序能够顺利编译通过,但在浏览器中运行时,JAVA控制台却出现了下面的错误信息:(浏览器中显示的是装入小程序失败!并且显示的是一个左上角有一把“红叉叉”的白色矩形区域!) java.lang.NoClassDefFoundError: ClickMe (wrong name: com/dazern/web/ClickMe) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at sun.applet.AppletClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.applet.AppletClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.applet.AppletClassLoader.loadCode(Unknown Source) at sun.applet.AppletPanel.createApplet(Unknown Source) at sun.plugin.AppletViewer.createApplet(Unknown Source) at sun.applet.AppletPanel.runLoader(Unknown Source) at sun.applet.AppletPanel.run(Unknown Source) at java.lang.Thread.run(Unknown Source) 并且我在DOS中用appletviewer查看时,命令运行完后没有任何反映,也不能看到正确结果!在这里我想请问大家这是什么原因!我用的JDK版本是5.0的,以前在用JDK1.4时不会存在这样的问题!我想是不是因为使用的是5.0的原因,希望给为高手能给我个具体的解释! 急待解决,在线等待! 在此先谢谢各位了!谢谢! |
2.Re:向大家请教J2SE5.0中APPLET小程序运行问题! [Re: dazern] | Copy to clipboard |
Posted by: kavinwang Posted on: 2005-04-16 17:42 我不是太清楚,不过你可以加上codebase试一下。 |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |