Exception in thread "main" java.lang.NoClassDefFoundError
5 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Kunal_Joshi
Posted On:   Wednesday, March 16, 2005 09:43 PM

Exception in thread "main" java.lang.NoClassDefFoundError:

this error occurs when i run my java program. what can be the problem in it?

Re: Exception in thread "main" java.lang.NoClassDefFoundError

Posted By:   Anonymous  
Posted On:   Monday, April 18, 2005 12:20 AM

Hi ,

Reason for getting this error :

1) Your class name and file name are not same

2) Path and classpath have not been set properly

I hope if you take care of the above two you may no get this error again.

Happy coding....

vaibahv

Re: Exception in thread "main" java.lang.NoClassDefFoundError

Posted By:   Anonymous  
Posted On:   Wednesday, March 30, 2005 10:55 AM

I can compile but not able to run java program.My environment variables are
path=c:J2sdk1.4.2_04in;
CLASSPATH=c:J2sdk1.4.2_04lib;

Re: Exception in thread "main" java.lang.NoClassDefFoundError

Posted By:   vishvadeepak_tewari  
Posted On:   Thursday, March 17, 2005 10:26 AM

may be the compiler was not able to find main() method

Re: Exception in thread "main" java.lang.NoClassDefFoundError

Posted By:   deepak_dhananjaya  
Posted On:   Thursday, March 17, 2005 02:37 AM


see basically what happenes when u say
> java MainClass
is it will try to find MainClass.class file
if this file is not found in the current directory then it will search in the path set in the environment variable
$CLASSPATH so if it does not find it there also then it will give u this error

so what u do is

first set the $CLASSPATH env variable to the directory which contains the .class file and then try to run it.

hope this should solve ur problem

Re: Exception in thread "main" java.lang.NoClassDefFoundError

Posted By:   WarnerJan_Veldhuis  
Posted On:   Thursday, March 17, 2005 01:32 AM

It means your program is trying to use a class, but it cannot find it.... http://www.mindprod.com/jgloss/runerrormessages.html#NOCLASSDEFFOUNDERROR
About | Sitemap | Contact