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" 这样的错误提示
希望大家帮我解决解决,在此谢谢大家了