wood burning stoves*
The moose likes Beginning Java and the fly likes NoClassDefFoundError . exception Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "NoClassDefFoundError . exception Problem" Watch "NoClassDefFoundError . exception Problem" New topic
Author

NoClassDefFoundError . exception Problem

RajTilak Sivaluri
Greenhorn

Joined: Nov 13, 2010
Posts: 18
I am using windows 7 platform i installed java 6 and i am trying to compile a small java program producing an output helloworld! but when i try to run the program i am finding an exception saying NoClassDefFoundError

The error looks as below:


C:\Test>java Test
Exception in thread "main" java.lang.NoClassDefFoundError: Test
Caused by: java.lang.ClassNotFoundException: Test
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: Test. Program will exit.


The program i pretty simple i am just printing Hellow World !!
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

Are you sure it is in your directory and it isn't in a package?


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
RajTilak Sivaluri
Greenhorn

Joined: Nov 13, 2010
Posts: 18
Ya i tried its in my directory . Infact i tried to place this test.java file in the bin folder of java and i opened that path in command prompt and i tried to compile that . when i compile i find no error but when i try to run i am getting this exception and when i check out for the class file its there along with .java file .

I even tried to reinstall the java software still i face this problem
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

Is it Test or test? Classnames should begin with an uppercase character. And Java is case-sensitive.
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11246
    
  16

also, is your CLASSPATH environment variable set? If so, to what?


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: NoClassDefFoundError . exception Problem