File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Exception in thread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Exception in thread "main" java.lang.NoClassDefFoundError " Watch "Exception in thread "main" java.lang.NoClassDefFoundError " New topic
Author

Exception in thread "main" java.lang.NoClassDefFoundError

Rajesh Khan
Ranch Hand

Joined: Oct 16, 2011
Posts: 230
I am getting the following error , does anyone know what i am doing wrong

Anayonkar Shivalkar
Bartender

Joined: Dec 08, 2010
Posts: 1502
    
    5

Hi Rajesh Khan,

Always, SearchFirst. NoClassDefFoundError is very common error.

Have you put your Test class inside any package (exmple25)? In that case, you need to run it accordingly.

I hope this helps.


Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

It looks like the class Test is in the package example25.

What you should do is put the base directory of the package in the classpath, and specify the fully-qualified name of the class. For example, if C:\jibx\tutorial is the base directory, try a command like this:

java -cp C:\jibx\tutorial example25.Test

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Rajesh Khan
Ranch Hand

Joined: Oct 16, 2011
Posts: 230
Here what i tried. Unfortunately its not working
C:\jibx>java -cp C:\jibx\tutorial example25.Test
Anayonkar Shivalkar
Bartender

Joined: Dec 08, 2010
Posts: 1502
    
    5

Hi,

Now the same exception is occurring for a class org.jibx.runtime.JiBx.

Does that class exist in C:\jibx\tutorial directory in the same structure? That is, there must be a file named C:\jibx\tutorial\org\jibx\runtime\JiBx.class

If this structure (org.jibx.runtime.JiBx) is inside a jar file, then you have to give name of that jar file as well in classpath.

I hope this helps.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Exception in thread "main" java.lang.NoClassDefFoundError
 
Similar Threads
Why oh why do I even Try??
NoClassDefFoundError
a very primitive problem
No ClassDefFoundError
abstract class