zoukankan      html  css  js  c++  java
  • NoClassDefFoundError 与 java.lang.NoClassDefFoundError的区别

        While it's possible that this is due to a classpath mismatch between compile-time and run-time, it's not necessarily true.

       It is important to keep two or three different exceptions straight in our head in this case:

    1. java.lang.ClassNotFoundException This exception indicates that the class was not found on the classpath. This indicates that we were trying to load the class definition, and the class did not exist on the classpath.

    2. java.lang.NoClassDefFoundError This exception indicates that the JVM looked in its internal class definition data structure for the definition of a class and did not find it. This is different than saying that it could not be loaded from the classpath. Usually this indicates that we previously attempted to load a class from the classpath, but it failed for some reason - now we're trying to use the class again (and thus need to load it, since it failed last time), but we're not even going to try to load it, because we failed loading it earlier (and reasonably suspect that we would fail again). The earlier failure could be a ClassNotFoundException or an ExceptionInInitializerError (indicating a failure in the static initialization block) or any number of other problems. The point is, a NoClassDefFoundError is not necessarily a classpath problem.

       如上stactOverFlow高赞所述:博主最后的解决办法就是重新引入运行时缺失的Class所对应依赖,问题得到解决。

  • 相关阅读:
    c c++ 混合编译
    vlc sdl 播放视频可随窗口改变大小
    exec函数族的使用
    gcc编译器命令使用详解
    linux gcc 编译时头文件和库文件搜索路径
    VLC1.2 播放视频迟滞卡
    Ubuntu 中软件的安装、卸载以及查看的方法总结
    SDL2.0 VLC ubuntu安装和黑屏问题
    linux动态库与静态库混合连接
    FFMEPG -- A ffmpeg and SDL Tutorial : tutorial05
  • 原文地址:https://www.cnblogs.com/max1995/p/15158427.html
Copyright © 2011-2022 走看看