你一定import 了一些非jdk默认包含的包或类。
所以ie找不到,但是jb中在运行时是设置了classpath的。
明白了吗?

解决方案 »

  1.   

    package eeapplet;import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    import javax.swing.*;/**
     * <p>Title: </p>
     * <p>Description: </p>
     * <p>Copyright: Copyright (c) 2003</p>
     * <p>Company: </p>
     * @author not attributable
     * @version 1.0
     */public class eeapplet extends Applet {
      boolean isStandalone = false;
      //Get a parameter value
      public String getParameter(String key, String def) {
        return isStandalone ? System.getProperty(key, def) :
          (getParameter(key) != null ? getParameter(key) : def);
      }  //Construct the applet
      public eeapplet() {
      }
      //Initialize the applet
      public void init() {
        try {
          jbInit();
        }
        catch(Exception e) {
          e.printStackTrace();
        }
      }
      //Component initialization
      private void jbInit() throws Exception {
        this.setSize(new Dimension(400,300));
      }
      //Start the applet
      public void start() {
      }
      //Stop the applet
      public void stop() {
      }
      //Destroy the applet
      public void destroy() {
      }
      //Get Applet information
      public String getAppletInfo() {
        return "Applet Information";
      }
      //Get parameter info
      public String[][] getParameterInfo() {
        return null;
      }
      //Main method
      public static void main(String[] args) {
        eeapplet applet = new eeapplet();
        applet.isStandalone = true;    Frame frame = new  Frame();
        //EXIT_ON_CLOSE == 3
    //    frame.setDefaultCloseOperation(3);
        frame.setTitle("Applet Frame");
    //    frame.getContentPane().add(applet, BorderLayout.CENTER);
        frame.add(applet, BorderLayout.CENTER);    applet.init();
        applet.start();
        frame.setSize(400,320);
        Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
        frame.setLocation((d.width - frame.getSize().width) / 2, (d.height - frame.getSize().height) / 2);
        frame.setVisible(true);
      }  //static initializer for setting look & feel
      static {
        try {
          //UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
          //UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
        }
        catch(Exception e) {
        }
      }
    }