请问NoClassDefFoundError是什么回事?
我按照教学书写了以下程序:public class MyFirst extends java.applet.Applet
{
public static void main(String args[])
{
MyFirst mf=new MyFirst();
mf.init();
}
public void init()
{
LeiJia LeiJiaShuZi=new LeiJia(10);
System.out.println(LeiJiaShuZi.ZongHe());
}
}
class LeiJia
{
int iN;
public LeiJia(int iN)
{
this.iN=iN;
}
public int ZongHe()
{
int i,sum;
sum=0;
for (i=1;i<=iN;i++)
sum+=1;
return sum;
}
}
编译后执行,出错:
Exception in thread "main" java.lang.NoClassDefFoundError: MyFirst
我的profile里是这样设置的:
JAVA_HOME=/home/bl/j2sdk_nb/j2sdk1.4.2
export JAVA_HOME
CLASSPATH=/home/bl/j2sdk_nb/j2sdk1.4.2/lib:/home/bl/j2sdk_nb/j2sdk1.4.2/jre/lib:/home/bl/j2sdk_nb/j2sdk1.4.2/lib/dt.jar:/home/bl/j2sdk_nb/j2sdk1.4.2/lib/tools.jar
export CLASSPATH
PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin
exportPATH
请问怎么解决?谢谢! 在CLASSPATH中加入:“.”(当前目录) 解决啦!谢谢minsj!
页:
[1]