This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Java in General and the fly likes error while executing.. NoClassDefFound error. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "error while executing.. NoClassDefFound error." Watch "error while executing.. NoClassDefFound error." New topic

error while executing.. NoClassDefFound error.

Deepak Damodaran

Joined: Jan 10, 2007
Posts: 3
hii everybody..

i have complied a program(or any program) but when i satrs to execute it shows an error of

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

can anybody tell me how to fix this problem....
mohsen fakhari

Joined: May 04, 2003
Posts: 25
Obviously it cannot find one of your classes!
Maybe the class is not in your classpath.
Maybe you've misspelled its name.
Deepak Damodaran

Joined: Jan 10, 2007
Posts: 3
i hav set classpath.. even class mae is also correct..but even a simple HELLO program is not workin
fred rosenberger
lowercase baba

Joined: Oct 02, 2003
Posts: 11815

This should probably be in the beginner's forum.

However, when you run your program, are you typing


or are you typeing

"java classname"?

There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Deepak Damodaran

Joined: Jan 10, 2007
Posts: 3
i hav typed " java class name " but still error occurs.. but i cleared it . i had to reinstall java it is okay now thank you guys for your comments
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14917

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

The "/java" at the end of the error message indicates that you have typed:


instead of:

java classname

Re-installing Java was not necessary... :roll:

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
I agree. Here's the link:
subject: error while executing.. NoClassDefFound error.
It's not a secret anymore!