ClassNotFoundException vs NoClassDefFoundError

前端 未结 9 1916
半阙折子戏
半阙折子戏 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:36

    One of cases where NoClassDefFoundError occur is when the Class JVM is trying to access is not found in classpath. But if class is present in classpath, It will result in ClassNotFoundException.

    In short NoClassDefFoundError will come if a class was present during compile time but not available in java classpath during runtime.

    Just try to run with explicit -classpath option where the classpath does not contain class B.

提交回复
热议问题