File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Linux / UNIX and the fly likes NoClassDefFoundError Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "NoClassDefFoundError" Watch "NoClassDefFoundError" New topic


Abhishek Dhama

Joined: Nov 17, 2003
Posts: 12
Hi all,
I am a newbie on linux.
I wrote this test program to run on JDK I installed. It compiled fine but when I tried to run it walked out with
<error message>
Exception in thread "main" java.lang.NoClassDefFoundError: Test
</error message>
Now yes I did type "java Test" and I did set CLASSPATH and JAVA_HOME variables right.
I am running Redhat 9.0 .
JDK installed is 1.4
I not able to figure out where I went wrong
I am not attaching code snipet coz it isnt doing much simple Hello world types.
Thanks in advance
Ranch Hand

Joined: May 28, 2002
Posts: 95
Hello Abhishek,
Seems like your classpath doesnt point to the current directory. There is no need to set the classpath as an environment variable, its discouraged.
To quickly check if this is the problem try the following:
prompt> java -classpath . Test
This is the preferred method of setting the classpath. Basically, if your classpath is set for example in .bash_profile, and it doesnt include the current directory '.', then the default classpath when running the 'java' command which is the current directory, is ignored, and your Test class is therefore not found.
Check this:
for general classpath info.
I agree. Here's the link:
subject: NoClassDefFoundError
jQuery in Action, 3rd edition