File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
Author

NoClassDefFoundError

Abhishek Dhama
Greenhorn

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
/abhishek
Nart
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: http://faq.javaranch.com/view?HowToSetTheClasspath
for general classpath info.
Nart
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: NoClassDefFoundError
 
Similar Threads
Trying to run my first program: java.lang.NoClassDefFoundError
JRun problem
Tomcat installation on Linux.. need help..
get a error compiling jsp in jbuilder6,but it is right under weblogic. what's wrong
Getting JDK 1.3 to work!