| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1794 人关注过本帖
标题:java.lang.NoSuchMethodError: main错误,急救
取消只看楼主 加入收藏
yanhaha
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2008-9-24
收藏
 问题点数:0 回复次数:0 
java.lang.NoSuchMethodError: main错误,急救
下面是我的原程序,在Eclipse中运行出现如下错误,声明一下,我这集成环境编过好几个程序都没问题的
import javax.swing.*;
import java.awt.*;
import javax.swing.border.*;
class BarWin extends JFrame implements Runnable
{
    JProgressBar progressBar1,progressBar2;
    JTextField text1,text2;
    Thread thread1,thread2;
    BarWin()
    {
        super("进度条组件");
        progressBar1=new JProgressBar(0,100);
        progressBar2=new JProgressBar(0,100);
        text1=new JTextField(10);
        text2=new JTextField(10);
        thread1=new Thread(this);
        thread2=new Thread(this);
        Box box1=Box.createVerticalBox();
        box1.add(progressBar1);
        box1.add(Box.createVerticalStrut(10));
        box1.add(progressBar2);
        Box box2=Box.createVerticalBox();
        box2.add(text1);
        box2.add(Box.createVerticalStrut(10));
        box2.add(text2);
        Box basebox=Box.createHorizontalBox();
        basebox.add(box1);
        basebox.add(Box.createHorizontalStrut(10));
        basebox.add(box2);
        Container con=getContentPane();
        con.setLayout(new FlowLayout());
        con.add(basebox);
        setVisible(true);
        setBounds(100,100,200,200);
        validate();
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        
    }
    public void run()
    {
        if(Thread.currentThread()==thread1)
        {
            for(int i=1;i<=100;i++)
            {
                text1.setText("第"+i+"项="+f(i));
                progressBar1.setValue(i);
                try
                {
                    Thread.sleep(500);
                }
                catch(InterruptedException e)
                {
                    
                }
                
            }
        }
        if(Thread.currentThread()==thread2)
        {
            long a1=1,a2=1,a=a1;
            int i=1;
            while(i<=100)
            {
                if(i>3)
                {
                    a=a1+a2;
                    a1=a2;
                    a2=a;
                }
                text2.setText("第"+i+"项="+a);
                progressBar2.setValue(i);
                i++;
            }
            try
            {
                Thread.sleep(500);
            }
            catch(InterruptedException e)
            {
                
            }
        }
    }
    long f(int n)
    {
        long c=0;
        if(n==1||n==2)
            c=1;
        else if(n>1)
            c=f(n-1)+f(n-2);
        return c;
    }
}
public class E04
{
    public static void mian(String args[])
    {
        BarWin win=new BarWin();
        win.thread1.start();
        win.thread2.start();
    }

}
运行完以后出现java.lang.NoSuchMethodError: main
Exception in thread "main" 这样的错误提示
希望大家帮我解决解决,在此谢谢大家了
搜索更多相关主题的帖子: java main lang 急救 
2008-09-24 15:16
快速回复:java.lang.NoSuchMethodError: main错误,急救
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.027646 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved