{"id":11137,"date":"2023-05-19T21:44:53","date_gmt":"2023-05-19T13:44:53","guid":{"rendered":"http:\/\/123.57.164.21\/?p=11137"},"modified":"2023-05-19T21:44:53","modified_gmt":"2023-05-19T13:44:53","slug":"classnotfoundexception%e5%92%8cnoclassdeffounderror%e4%bd%a0%e5%bc%84%e6%87%82%e4%ba%86%e5%90%97%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/92it.top\/?p=11137","title":{"rendered":"ClassNotFoundException\u548cNoClassDefFoundError\u4f60\u5f04\u61c2\u4e86\u5417\uff1f"},"content":{"rendered":"\n<p><strong>\u5f15\u8a00<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>Java\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u5e38\u89c1\u4e24\u79cd\u67e5\u627e\u4e0d\u5230Class\u7684\u5f02\u5e38\u60c5\u51b5<\/p>\n\n\n\n<ul><li><code>java.lang.ClassNotFoundException<\/code><\/li><li><code>java.lang.NoClassDefFoundError<\/code><\/li><\/ul>\n\n\n\n<p>\u4e8c\u8005\u4e3b\u8981\u533a\u522b\u662f\u663e\u5f0f\u88c5\u8f7d\u7684\u65f6\u5019\u627e\u4e0d\u5230\u7c7b\u8fd8\u662f\u9690\u5f0f\u88c5\u8f7d\u7684\u65f6\u5019\u627e\u4e0d\u5230\u7c7b\u3002<br>\u5728Java\u4e2d\uff0c\u7c7b\u9700\u8981\u88ab<a rel=\"noreferrer noopener\" href=\"https:\/\/so.csdn.net\/so\/search?q=%E7%B1%BB%E5%8A%A0%E8%BD%BD%E5%99%A8&amp;spm=1001.2101.3001.7020\" target=\"_blank\">\u7c7b\u52a0\u8f7d\u5668<\/a>\u52a0\u5230\u5230JVM\u5185\u5b58\u4e2d\u624d\u80fd\u88ab\u4f7f\u7528\uff0c\u7c7b\u7684\u88c5\u8f7d\u6709\u663e\u5f0f\u88c5\u8f7d\u548c\u9690\u5f0f\u88c5\u8f7d\u4e24\u79cd\u65b9\u5f0f\uff0c\u5f04\u660e\u767d\u8fd9\u4e24\u79cd\u65b9\u5f0f\u624d\u80fd\u66f4\u597d\u7406\u89e3\u8fd9\u4e24\u79cd\u5f02\u5e38\u3002<\/p>\n\n\n\n<p><strong>\u4e00\u3001\u663e\u5f0f\u88c5\u8f7d<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u663e\u5f0f\u88c5\u8f7d\u6307\u7684\u662f\u5728\u7a0b\u5e8f\u4e2d\u4f7f\u7528\u6307\u5b9a\u7684\u65b9\u6cd5\u52a0\u8f7d\u6307\u5b9a\u7684\u7c7b\uff0c\u76ee\u524d\u6709\u4ee5\u4e0b\u4e09\u79cd\u60c5\u51b5<\/p>\n\n\n\n<ul><li><code>Class.forName()<\/code><\/li><li><code>ClassLoader\u7684loadClass\u65b9\u6cd5<\/code><\/li><li><code>ClassLoader\u7684findSystemClass()\u65b9\u6cd5<\/code>(protected final,\u53ea\u80fd\u5728\u672c\u7c7b\u6216\u8005\u7ee7\u627f\u7684\u5b50\u7c7b\u624d\u53ef\u4ee5\u4f7f\u7528)<\/li><\/ul>\n\n\n\n<p>\u5f53\u8c03\u7528\u4ee5\u4e0a\u4efb\u4f55\u4e00\u4e2a\u65b9\u6cd5\u7684\u65f6\u5019\uff0c\u6307\u5b9a\u7684\u7c7b\u7531\u7c7b\u88c5\u88c5\u8f7d\u5668\u88c5\u5165\u3002\u5982\u679c\u7c7b\u5df2\u7ecf\u52a0\u8f7d\uff0c\u90a3\u4e48\u53ea\u662f\u8fd4\u56de\u4e00\u4e2a\u5f15\u7528\uff1b\u5426\u5219\uff0c\u7c7b\u88c5\u8f7d\u5668\u4f1a\u901a\u8fc7\u59d4\u6258\u6a21\u578b\u52a0\u8f7d\u7c7b\u3002<\/p>\n\n\n\n<p><strong>\u4e8c\u3001\u9690\u5f0f\u88c5\u8f7d<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u9690\u5f0f\u88c5\u8f7d\u53d1\u751f\u5728\u7531\u4e8e\u5f15\u7528\u3001\u5b9e\u4f8b\u5316(new)\u6216\u7ee7\u627f\u5bfc\u81f4\u52a0\u8f7d\u7c7b\u7684\u65f6\u5019\uff08\u4e0d\u662f\u901a\u8fc7\u663e\u5f0f\u65b9\u6cd5\u8c03\u7528\uff09\u3002\u5728\u6bcf\u79cd\u60c5\u51b5\u4e0b\uff0c\u7c7b\u7684\u52a0\u8f7d\u90fd\u662f\u5728\u5e55\u540e\u542f\u52a8\u7684\uff0cJVM \u4f1a\u89e3\u6790\u5fc5\u8981\u7684\u5f15\u7528\u5e76\u52a0\u8f7d\u7c7b\u3002\u4e0e\u663e\u5f0f\u7c7b\u88c5\u5165\u4e00\u6837\uff0c\u5982\u679c\u7c7b\u5df2\u7ecf\u88ab\u52a0\u8f7d\u4e86\uff0c\u90a3\u4e48\u53ea\u662f\u8fd4\u56de\u4e00\u4e2a\u5f15\u7528\uff1b\u5426\u5219\uff0c\u7c7b\u88c5\u8f7d\u5668\u4f1a\u901a\u8fc7\u59d4\u6258\u6a21\u578b\u52a0\u8f7d\u7c7b\u3002<\/p>\n\n\n\n<p><strong>\u4e09\u3001\u4e24\u79cd\u5f02\u5e38\u7684\u533a\u522b<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u7c7b\u7684\u52a0\u8f7d\u901a\u5e38\u7ec4\u5408\u4e86\u663e\u5f0f\u548c\u9690\u5f0f\u3002\u4f8b\u5982\uff0c\u7c7b\u88c5\u8f7d\u5668\u53ef\u80fd\u5148\u663e\u5f0f\u5730\u52a0\u8f7d\u4e00\u4e2a\u7c7b\uff0c\u7136\u540e\u518d\u9690\u5f0f\u5730\u52a0\u8f7d\u5b83\u5f15\u7528\u7684\u6240\u6709\u7c7b\u3002<br>ClassNotFoundException\u53d1\u751f\u5728\u663e\u5f0f\u88c5\u8f7d\u7c7b\u7684\u65f6\u5019\u67e5\u627e\u4e0d\u5230\u5bf9\u5e94\u7684\u7c7b\u6587\u4ef6\uff1b<br>NoClassDefFoundError\u53d1\u751f\u5728\u9690\u5f0f\u88c5\u8f7d\u7c7b\u7684\u65f6\u5019\u67e5\u627e\u4e0d\u5230\u5bf9\u5e94\u7684\u7c7b\u6587\u4ef6\u7684\u65f6\u5019\uff0c\u6b64\u65f6\u6267\u884c\u7684\u7c7b\u5df2\u7ecf\u7f16\u8bd1\u4f46\u662f\u5728\u6267\u884c\u7684\u65f6\u5019\u627e\u4e0d\u5230\u5b9a\u4e49\u7684\u7c7b\u6587\u4ef6\uff0c\u4e5f\u5c31\u662f\u8bf4\u5f15\u7528\u7684\u7c7b\u5728\u7c7b\u8def\u5f84\u4e2d\u6ca1\u6709\u627e\u5230\u3002<br><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5f15\u8a00 Java\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u5e38\u89c1\u4e24\u79cd\u67e5\u627e\u4e0d\u5230Class\u7684\u5f02\u5e38\u60c5\u51b5 java.lang.ClassNotFoundE [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[],"_links":{"self":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/11137"}],"collection":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=11137"}],"version-history":[{"count":1,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/11137\/revisions"}],"predecessor-version":[{"id":11138,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/11137\/revisions\/11138"}],"wp:attachment":[{"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=11137"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=11137"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=11137"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}