我以正常的方式运行它并通过Run as - >运行配置 - > Java Applet并在那里创建applet apple,因为我的类被命名为:
package test;
import java.awt.*;
import javax.swing.*;
public class apples extends JApplet{
/**
*
*/
private static final long serialVersionUID = 1L;
public void paint(Graphics g){
super.paint(g);
g.drawString("Wow this actually worked?", 25, 25);
}
}
使用Run as函数运行它时的错误消息是:
load: class apples.class not found.
java.lang.ClassNotFoundException: apples.class
at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:219)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:152)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:634)
at sun.applet.AppletPanel.createApplet(AppletPanel.java:799)
at sun.applet.AppletPanel.runLoader(AppletPanel.java:728)
at sun.applet.AppletPanel.run(AppletPanel.java:378)
at java.lang.Thread.run(Thread.java:745)