Java programming problem in linux box: Exception in thread "main" java.lang.NoClassDefFoundError

Most people always have the following problem when run their java programs under linux box:
Exception in thread "main" java.lang.NoClassDefFoundError: *.java
Even though these programs  really have no problem at all.
Here are some solutions for you:
1) Check your syntax that you are trying to run the java class and make sure it should be like this (assume the class file is foo.class):
java  foo      instead of    java  foo.class

2) Make sure your classpath contain the special path ".", actually this is most likely where the problem come from. 
You can try to run your program as follows.

java -cp .  foo   or
java  -classpath  .  foo

If it works, then you are suppose to add "." to you classpath.
For example:
export CLASSPATH=.:$JAVA_HOME/lib:JAVA_HOME/jre/lib

3) Check it out if you compiled the java file without specifying the package that import in your file.

What if all these works are done, but your still got the same problem?
Well, in this case, you've got to have a look at your souce code......

Good luck!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值