小弟刚学JAVA,做了个小的程序,但编译运行不出结果?用的是JDK.
import java.awt.*;
import java.awt.event.*;
public class cToDec extends Frame implements ActionListener
{
Label dec;
TextField input;
public cToDec()
{
   super("binary to decimal");
   dec=new Label("...结果...");
   input=new TextField(15);
   Button convert=new Button("转换");
       setLayout(new FlowLayout());
   add(input);
   add(convert);
   add(dec);
   convert.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{
   String s=input.getText();
   int x=Integer.parseInt(s,2);
   dec.setText("result="+x);
}
public static void main(String args[])
{
   Frame x=new cToDec();
   x.setSize(400,100);
   x.setVisible(true);
}
}运行时说:Exception in thread "main" java.lang.NoClassDefFoundError: cToDec  明明没错啊~!

解决方案 »

  1.   

    去看本版的FAQ,肯定又是classpath设置问题
      

  2.   

    FAQ是虾米东西啊?
    另外我的CLASSPATH配置没问题啊
    applet程序都能通过~!
      

  3.   

    classpath设置问题
    applet不需要classpath
      

  4.   

    哦  谢谢了~!
    但是我设置windows的classpath明明是对的,可是不行
    非要在cmd里set classpath=%classpath%;.  才能运行
    每次这样太麻烦了~!