Why am I getting a NoClassDefFoundError in Java?

I am obtaining a NoClassDefFoundError when I run my Java application. What is commonly the source of this?

628
2022-06-06 18:16:39
Source Share
Answers: 2

This is created when there is a class documents that your code relies on and also it exists at compile time yet not located at runtime. Seek distinctions in your construct time and also runtime classpaths.

323
2022-06-06 18:31:06
Source

I have actually located that occasionally I get a NoClassDefFound mistake when code is assembled with an inappropriate variation of the class located at runtime. The details instance I remember is with the apache axis collection. There were in fact 2 variations on my runtime classpath and also it was grabbing the outdated and also inappropriate variation and also not the proper one, creating a NoClassDefFound mistake. This remained in a command line application where I was making use of a command comparable to this.

set classpath=%classpath%;axis.jar

I had the ability to get it to grab the correct variation by utilizing:

set classpath=axis.jar;%classpath%;
34
2022-06-06 18:30:55
Source