我正在尝试运行简单的“Hello world”java applet 程序。但是在执行时小程序不会出现在浏览器中,而是发生 ClassNotFoundException。
这就是我从浏览器访问它的方式:-
<applet width="500" height="50" codebase="http://localhost:13383/tuexample/"
code="dk.certificate.demo.DemoApplet.class" >...applet..</applet>
Java代码:-
import java.applet.Applet;
import java.awt.Graphics;
public class DemoApplet extends Applet
{
private static final long serialVersionUID = 1L;
@Override
public void paint(Graphics g)
{
g.drawString("Welcome in Java Applet.",40,20);
}
}
异常日志:-
Java Plug-in 10.21.2.11
Using JRE version 1.7.0_21-b11 Java HotSpot(TM) Client VM
User home directory = C:\Users\rahil_khan
----------------------------------------------------
c: clear console window
f: finalize objects on finalization queue
g: garbage collect
h: display this help message
l: dump classloader list
m: print memory usage
o: trigger logging
q: hide console
r: reload policy configuration
s: dump system and deployment properties
t: dump thread list
v: dump thread stack
x: clear classloader cache
0-5: set trace level to <n>
----------------------------------------------------
28-May-2013 14:20:51 <INFO> thread applet-dk.pbs.applet.bootstrap.BootApplet-1 - stop
28-May-2013 14:20:51 <INFO> thread applet-dk.pbs.applet.bootstrap.BootApplet-1 -
destroy