ClassNotFoundException vs NoClassDefFoundError

前端 未结 9 1895
半阙折子戏
半阙折子戏 2020-12-23 11:59

I have gone through this thread What causes and what are the differences between NoClassDefFoundError and ClassNotFoundException? This is what one of the ans,which has max u

9条回答
  •  不思量自难忘°
    2020-12-23 12:46

    The other answers in this thread are correct, i just want to add something i spent hours trying to figure out. Even if

    Class.forName("apache.some.SomeLegitClass")
    

    works,

    Class.forName("apache.some.somelegitclass")
    

    will result in a NoClassDefFoundError. The Class.forName() is case-sensitive. It will result in different exceptions if the classname is spelled wrong, or simply has incorrect casing.

提交回复
热议问题