当用jcreator编译运行java的applet小程序时候,总是提示exception in thread "main".java.lang nosuchmethodeError:main, 但是在DOC环境下 通过运行
appletveiwer *.java 却是可以运行的,为什么???

解决方案 »

  1.   

    package org.bign;import java.applet.Applet;
    import java.awt.Frame;
    import java.awt.Graphics;import javax.swing.JFrame;public class Sample extends Applet {
        /**
         *
         */
        private static final long serialVersionUID = 1L;
        public static void main(String[] args) {
            JFrame jf = new JFrame();//新建Frame
            Sample sample = new Sample();
            jf.add(sample);//添加容器
            sample.init();
            jf.setSize(200,300);
            jf.setVisible(true);
        }    public void paint(Graphics g) {
            g.drawLine(0, 0, 100, 100);// 画直线
            g.drawRect(10, 10, 50, 40);// 画矩形
            g.fillRect(20, 20, 50, 40);// 填充矩形
        }
      

  2.   

    楼上说的还是不行啊, 这个问题是说  在JCREATOR中怎么样能运行 applet小程序
      

  3.   

    楼主,不行的话就直接在DOS下面运行就行了,为什么偏要到JCreator中运行呢.