アプレットを実行しようとすると、次の例外が発生します。
load: class MyApplet not found.
java.lang.ClassNotFoundException: MyApplet
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read1(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at java.net.HttpURLConnection.getResponseCode(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.getBytes(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.access$000(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
... 9 more
Exception: java.lang.ClassNotFoundException: MyApplet
アプレットコード:
import javax.swing.*;
import java.awt.*;
public class MyApplet extends JApplet {
public JFrame frame;
public JPanel panel;
public JButton button;
public void init() {
frame = new JFrame();
panel = new JPanel();
button = new JButton("click me ");
panel.setBackground(Color.RED);
panel.add(button);
frame.add(panel);
frame.setSize(300,300);
frame.setVisible(true);
}
}
html コード:
<applet code="MyApplet" codebase="AppletPackage" archive="JAR.jar" height="800" width="800">
JAR.jar ファイルにはパッケージ Appletpackage が含まれており、このパッケージには次の名前のクラス ファイルが含まれています。MyApplet.class
なぜこの例外が発生するのですか? 私はどこで間違いを犯しましたか?