W
wukw
Unregistered / Unconfirmed
GUEST, unregistred user!
1。
public class HelloJava extends Object
{
public static void main(String[] args)
{
System.out.println("Hello World!");
}
}
用javac编译没有任何问题,但执行 java HelloJava 时,出现下列错:
Exception in thread "main" java.lang.NoClassDefFoundError:HelloJava
望各位同志指教!
2。
import java.awt.*;
import java.applet.*;
public class HelloJavaApplet extends Object
{
public void paint(Graphics g)
{
g.drawString("Hello Everybody!", 25, 25);
}
}
用javac编译没有任何问题,但执行 HelloJavaApplet.html 时,出现下列错:
屏幕正中间显示:java.lang.ClassCastException:HelloJavaApplet,而没有显示 Hello Everybody!
HelloJavaApplet.html 代码如下:
<APPLET CODE="HelloJavaApplet" WIDTH="500" HEIGHT="400">
你的浏览器不支持Java Applet
</APPLET>
点了一下系统托盘里的Java程序(估计是什么后台程序,我不太清楚),有如下显示:
java.lang.ClassCastException: HelloJavaApplet
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)
public class HelloJava extends Object
{
public static void main(String[] args)
{
System.out.println("Hello World!");
}
}
用javac编译没有任何问题,但执行 java HelloJava 时,出现下列错:
Exception in thread "main" java.lang.NoClassDefFoundError:HelloJava
望各位同志指教!
2。
import java.awt.*;
import java.applet.*;
public class HelloJavaApplet extends Object
{
public void paint(Graphics g)
{
g.drawString("Hello Everybody!", 25, 25);
}
}
用javac编译没有任何问题,但执行 HelloJavaApplet.html 时,出现下列错:
屏幕正中间显示:java.lang.ClassCastException:HelloJavaApplet,而没有显示 Hello Everybody!
HelloJavaApplet.html 代码如下:
<APPLET CODE="HelloJavaApplet" WIDTH="500" HEIGHT="400">
你的浏览器不支持Java Applet
</APPLET>
点了一下系统托盘里的Java程序(估计是什么后台程序,我不太清楚),有如下显示:
java.lang.ClassCastException: HelloJavaApplet
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)