Questions tagged [noclassdeffounderror]

The Java Error thrown if the Java Virtual Machine or a ClassLoader instance tries to load in the definition of a class (as part of a normal method call or as part of creating a new instance using the new expression) and a valid representation of the class could not be constructed.

The Java Error thrown if the Java Virtual Machine or a ClassLoader instance tries to load in the definition of a class (as part of a normal method call or as part of creating a new instance using the new expression) and no definition of the class could be found.

The searched-for class definition existed when the currently executing class was compiled, but the definition can no longer be found. This error is also caused by an uncaught exception in the static initializer of the class.

Don't confuse it with , it's a different kind of error, see the following links for more details:

2094 questions
576
votes
30 answers

Why am I getting a NoClassDefFoundError in Java?

I am getting a NoClassDefFoundError when I run my Java application. What is typically the cause of this?
John Meagher
  • 20,560
  • 13
  • 50
  • 57
379
votes
15 answers

What causes and what are the differences between NoClassDefFoundError and ClassNotFoundException?

What is the difference between NoClassDefFoundError and ClassNotFoundException? What causes them to be thrown? How can they be resolved? I often encounter these throwables when modifying existing code to include new jar files. I have hit them on…
krisp
  • 4,617
  • 5
  • 22
  • 25
240
votes
31 answers

How can I solve "java.lang.NoClassDefFoundError"?

I've tried both the examples in Oracle's Java Tutorials. They both compile fine, but at run time, both come up with this error: Exception in thread "main" java.lang.NoClassDefFoundError: graphics/shapes/Square at Main.main(Main.java:7) Caused…
Jonathan Lam
  • 15,294
  • 14
  • 60
  • 85
196
votes
25 answers

Getting java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory exception

i am executing simple Dependency Injection program of spring & getting this exception. I have already included common-logging1.1.1.jar and spring.jar file. Could you please help to out? Exception in thread "main" java.lang.NoClassDefFoundError:…
user188102
184
votes
10 answers

java.lang.NoClassDefFoundError: Could not initialize class XXX

public class PropHolder { public static Properties prop; static { //code for loading properties from file } } // Referencing the class somewhere else: Properties prop = PropHolder.prop; class PropHolder is a class of my own. The class…
Leon
  • 7,253
  • 10
  • 43
  • 49
120
votes
20 answers

java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing

While running junit test in eclipse I am getting this Exception: java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing I've added junit.jar library file. I've tried different versions of junit.jar: 4.4, 4.8, etc. How do I fix this Exception?
user2013948
  • 1,201
  • 2
  • 8
  • 3
95
votes
4 answers

java.lang.NoClassDefFoundError: android/graphics/drawable/Icon

So far I got this error only for one user, who uses a rooted phone (SM-G900R7 Android 4.4.2). The error is like this: Fatal Exception: java.lang.NoClassDefFoundError: android/graphics/drawable/Icon at…
cn123h
  • 2,182
  • 1
  • 19
  • 14
83
votes
17 answers

java.lang.NoClassDefFoundError in junit

I am getting this error in java in my junit test code. I looked up on the net and it says that I need to add the junit.jar in the classpath. In Eclipse I have added it in the classpath of Project Properties windows but I still get initialisation…
user506710
82
votes
30 answers

Unable instantiate android.gms.maps.MapFragment

I try to do a demo with google maps android v2 with very simple activity, just copy code from google page: https://developers.google.com/maps/documentation/android/start#adding_the_api_key_to_your_application for activity: package…
mmm2006
  • 1,207
  • 2
  • 11
  • 17
77
votes
24 answers

NoClassDefFoundError for code in an Java library on Android

I am experiencing an error quite often among my users. The app crashes during startup. When the MainActivity is supposed to be loaded the VM apparently cannot find the class. I cannot figure out why. The architecture of the app is that there is a…
kjoelbro
  • 6,205
  • 4
  • 19
  • 18
64
votes
5 answers

NoClassDefFoundError: wrong name

I wrote a java program to test RESTful web services by using Netbeans7.0.1 and it works fine there. Now I wrote the build.xml file to compile the code and when I try to run the generated .class file I always got this exception: Exception in thread…
thinkBig
  • 765
  • 2
  • 7
  • 12
59
votes
9 answers

java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/JsonFactory

I am working on YouTube broadcast sample examples. I have created a sample Java Project & added required jars. But, when I try to run the project it throws exception. Exception : Throwable:…
VVB
  • 6,526
  • 7
  • 39
  • 71
55
votes
8 answers

Android java.lang.NoClassDefFoundError

I have an Android project in eclipse IDE which was working. After some imports and tests, I get the error: java.lang.NoClassDefFoundError. In my project I have two packages: the main one and the second one with some classes. When I try to…
Miloš
  • 17,005
  • 46
  • 137
  • 240
51
votes
24 answers

exception in thread 'main' java.lang.NoClassDefFoundError:

The following program is throwing error: public class HelloWorld { public static void main(String args[]) { System.out.println("Hello World!"); } } CLASSPATH C:\Program Files\Java\jdk1.6.0_18\bin\ Path C:\Program…
Haritha
  • 541
  • 2
  • 5
  • 4
46
votes
5 answers

NoClassDefFoundError JsonAutoDetect while parsing JSON object

I am developing a webapp using Amazon's cloud services and I need to make use of JSON objects. How my project is set up is, I have an HTML form where the user will fill in their information and submit. Once submitted the data will be placed into an…
jhahn
  • 461
  • 1
  • 4
  • 3
1
2 3
99 100