{"id":18450,"date":"2025-07-19T15:58:03","date_gmt":"2025-07-19T07:58:03","guid":{"rendered":"https:\/\/92it.top\/?p=18450"},"modified":"2025-07-19T15:58:03","modified_gmt":"2025-07-19T07:58:03","slug":"%e5%8f%8c%e4%ba%b2%e5%a7%94%e6%b4%be%ef%bc%9ajvm-%e9%87%8c%e9%82%a3%e4%b8%aa%e5%85%88%e9%97%ae%e7%88%b8%e7%88%b8%e7%9a%84%e7%b1%bb%e5%8a%a0%e8%bd%bd%e5%a5%97%e8%b7%af","status":"publish","type":"post","link":"https:\/\/92it.top\/?p=18450","title":{"rendered":"\u53cc\u4eb2\u59d4\u6d3e\uff1aJVM \u91cc\u90a3\u4e2a\u201c\u5148\u95ee\u7238\u7238\u201d\u7684\u7c7b\u52a0\u8f7d\u5957\u8def"},"content":{"rendered":"\n<p>\u8f6c\u8f7d\uff1a<a href=\"https:\/\/mp.weixin.qq.com\/s?__biz=MzI2MTExNTg3MQ==&amp;mid=2247486304&amp;idx=1&amp;sn=f2791882244a92af87ff99ea8af51477&amp;chksm=ebaa48ae94be3a0d7996912d534907729da808375b5fb7b4b3f87cb495a51fc16cb26b00bc51&amp;mpshare=1&amp;scene=1&amp;srcid=0719TlagA8VgJ9QcIwqi3Abu&amp;sharer_shareinfo=7f555889b3bc869d241a25b4fb31367e&amp;sharer_shareinfo_first=7f555889b3bc869d241a25b4fb31367e&amp;exportkey=n_ChQIAhIQ%2Bxcv2vmcv6lvASE6MPauwhL0AQIE97dBBAEAAAAAABxIIR9g0GcAAAAOpnltbLcz9gKNyK89dVj03wNOpacycJCgFV7kqGG6KrxewYEPTRrw%2FtvIt0gGUoV%2BI3F49iOtaGn31rSfT%2BAATxe2fJIZhRswFowcNnlnjDdvPCYGoVui5T4aIts%2F4jCEAl6xzcOQP0Tr52dA%2BFXXwgzd3XpoSAOiotTvd6751p6LVoCems6qzopMiqMWUMIFsPuU2c7AD%2B9xF%2FPmT1N9FVfWvlPAo%2B7u8LbHTUoGtWCklt5vH4DnONY9yv4LHw88mzI4AqP7dvYpdi0cNnwr69ShpwAjrj85H%2FZte0g%3D&amp;acctmode=0&amp;pass_ticket=SCYiN8pEz%2BoHS1XW3siyP6yAm7ZNGkVPnoWuvRi82RtBwGC6s9Ha2N%2B2Ah8nXCa1&amp;wx_header=0#rd\">\u53cc\u4eb2\u59d4\u6d3e\uff1aJVM \u91cc\u90a3\u4e2a\u201c\u5148\u95ee\u7238\u7238\u201d\u7684\u7c7b\u52a0\u8f7d\u5957\u8def<\/a><\/p>\n\n\n\n<p>\u5728 JVM \u7684\u7c7b\u52a0\u8f7d\u4f53\u7cfb\u4e2d\uff0c<strong>\u53cc\u4eb2\u59d4\u6d3e\u673a\u5236<\/strong>\u662f\u4e00\u4e2a\u975e\u5e38\u91cd\u8981\u7684\u8bbe\u8ba1\u601d\u60f3\uff0c\u4e5f\u662f\u4fdd\u969c Java \u7a0b\u5e8f\u5b89\u5168\u6027\u548c\u7a33\u5b9a\u6027\u7684\u91cd\u8981\u57fa\u7840\u3002\u5f53\u6211\u4eec\u5728\u7a0b\u5e8f\u4e2d\u8bf7\u6c42\u67d0\u4e2a\u7c7b\u52a0\u8f7d\u5668\u53bb\u52a0\u8f7d\u4e00\u4e2a\u7c7b\u65f6\uff0c\u5b83\u5e76\u4e0d\u4f1a\u7acb\u523b\u81ea\u5df1\u53bb\u627e\u8fd9\u4e2a\u7c7b\uff0c\u800c\u662f<strong>\u5148\u628a\u8bf7\u6c42\u4ea4\u7ed9\u81ea\u5df1\u7684\u7236\u52a0\u8f7d\u5668<\/strong>\uff0c\u8ba9\u7236\u52a0\u8f7d\u5668\u53bb\u5c1d\u8bd5\u52a0\u8f7d\u3002<strong>\u53ea\u6709\u5f53\u7236\u52a0\u8f7d\u5668\u65e0\u6cd5\u627e\u5230\u8fd9\u4e2a\u7c7b\u65f6\uff0c\u5f53\u524d\u52a0\u8f7d\u5668\u624d\u4f1a\u5c1d\u8bd5\u81ea\u5df1\u53bb\u52a0\u8f7d<\/strong>\u3002<\/p>\n\n\n\n<p>\u3000<\/p>\n\n\n\n<p><strong>\u8ba4\u8bc6\u53cc\u4eb2\u59d4\u6d3e<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u5728\u8ba4\u8bc6\u4e4b\u524d\u5fc5\u987b\u5148\u4e86\u89e3\u4e00\u4e0b\uff0c\u7c7b\u52a0\u8f7d\u7684\u79cd\u7c7b\uff1a<\/p>\n\n\n\n<ul>\n<li><strong>\u5f15\u5bfc\u7c7b\u52a0\u8f7d\u5668<\/strong>\uff1a\u8d1f\u8d23\u52a0\u8f7d\u652f\u6491JVM\u8fd0\u884c\u7684\u4f4d\u4e8eJRE\u7684lib\u76ee\u5f55\u4e0b\u7684\u6838\u5fc3\u7c7b\u5e93\uff0c\u6bd4\u5982 rt.jar\u3001charsets.jar\u7b49\u3002<\/li>\n\n\n\n<li><strong>\u6269\u5c55\u7c7b\u52a0\u8f7d\u5668<\/strong>\uff1a\u8d1f\u8d23\u52a0\u8f7d\u652f\u6491JVM\u8fd0\u884c\u7684\u4f4d\u4e8eJRE\u7684lib\u76ee\u5f55\u4e0b\u7684ext\u6269\u5c55\u76ee\u5f55\u4e2d\u7684JAR\u7c7b\u5305\u3002&nbsp;<\/li>\n\n\n\n<li><strong>\u5e94\u7528\u7c7b\u52a0\u8f7d\u5668<\/strong>\uff1a\u8d1f\u8d23\u52a0\u8f7dClassPath\u8def\u5f84\u4e0b\u7684\u7c7b\u5305\uff0c\u4e3b\u8981\u5c31\u662f\u52a0\u8f7d\u4f60\u81ea\u5df1\u5199\u597d\u7684\u90a3\u4e9b\u7c7b\u3002<\/li>\n\n\n\n<li><strong>\u81ea\u5b9a\u4e49\u52a0\u8f7d\u5668<\/strong>\uff1a\u8d1f\u8d23\u52a0\u8f7d\u7528\u6237\u81ea\u5b9a\u4e49\u8def\u5f84\u4e0b\u7684\u7c7b\u5305\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u800c\u53cc\u4eb2\u59d4\u6d3e\u5373\u5f53\u67d0\u4e2a\u7c7b\u52a0\u8f7d\u5668\u63a5\u5230\u52a0\u8f7d\u7c7b\u7684\u8bf7\u6c42\u65f6\uff0c\u5b83\u9996\u5148\u4e0d\u4f1a\u81ea\u5df1\u5904\u7406\uff0c\u800c\u662f\u5148\u628a\u8bf7\u6c42\u59d4\u6258\u7ed9\u5b83\u7684\u7236\u7c7b\u52a0\u8f7d\u5668\uff0c \u7236\u52a0\u8f7d\u5668\u4e5f\u91c7\u7528\u540c\u6837\u7684\u7b56\u7565\uff0c\u7ee7\u7eed\u628a\u8bf7\u6c42\u5411\u4e0a\u59d4\u6258\uff0c\u4e00\u76f4\u5230\u6700\u9876\u5c42\u7684&nbsp;<strong>Bootstrap \u7c7b\u52a0\u8f7d\u5668<\/strong>\uff0c Bootstrap \u7c7b\u52a0\u8f7d\u5668\u8d1f\u8d23\u52a0\u8f7d JDK \u6838\u5fc3\u7c7b\u5e93\uff08<code>rt.jar<\/code>&nbsp;\u4e2d\u7684\u7c7b\uff09\u3002\u5982\u679c\u5b83\u80fd\u627e\u5230\u76ee\u6807\u7c7b\uff0c\u5c31\u8fd4\u56de\u8fd9\u4e2a\u7c7b\u7684\u5b9a\u4e49\uff0c&nbsp;\u5982\u679c\u7236\u52a0\u8f7d\u5668\u90fd\u627e\u4e0d\u5230\u76ee\u6807\u7c7b\uff0c\u624d\u4f1a\u7531\u5f53\u524d\u7c7b\u52a0\u8f7d\u5668\u53bb\u67e5\u627e\u548c\u52a0\u8f7d\u3002<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"964\" height=\"646\" src=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/07\/image-120.png\" alt=\"\" class=\"wp-image-18452\" style=\"width:462px;height:auto\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/07\/image-120.png 964w, https:\/\/92it.top\/wp-content\/uploads\/2025\/07\/image-120-300x201.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2025\/07\/image-120-768x515.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2025\/07\/image-120-830x556.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2025\/07\/image-120-230x154.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2025\/07\/image-120-350x235.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2025\/07\/image-120-480x322.png 480w\" sizes=\"(max-width: 964px) 100vw, 964px\" \/><\/figure><\/div>\n\n\n<p><strong>\u5f53\u52a0\u8f7d\u67d0\u4e2a\u5b57\u8282\u7801\u7684\u65f6\u5019\uff0c\u5411\u4e0a\u59d4\u6258\uff0c\u9047\u5230\u4e00\u4e2a\u7c7b\uff0c\u5148\u7531\u7236\u7ea7\u52a0\u8f7d\uff0c\u4e00\u76f4\u52a0\u8f7d\u5230\u9876\u5c42\u52a0\u8f7d\u5668\uff0c\u7136\u540e\u518d\u5f80\u56de\u8d70\u770b\u5b50\u7c7b\u662f\u5426\u80fd\u52a0\u8f7d\u3002<\/strong><\/p>\n\n\n\n<p>\u3000<\/p>\n\n\n\n<p><strong>\u53cc\u4eb2\u59d4\u6d3e\u4f5c\u7528<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u6c99\u7bb1\u5b89\u5168\u673a\u5236\uff1a\u81ea\u5df1\u5199\u7684java.lang.String.class\u7c7b\u4e0d\u4f1a\u88ab\u52a0\u8f7d\uff0c\u8fd9\u6837\u4fbf\u53ef\u4ee5\u9632\u6b62\u6838\u5fc3API\u5e93\u88ab\u968f\u610f\u7be1\u6539<\/p>\n\n\n\n<p>\u907f\u514d\u7c7b\u7684\u91cd\u590d\u52a0\u8f7d\uff1a\u5f53\u7236\u7c7b\u5df2\u7ecf\u52a0\u8f7d\u4e86\u8be5\u7c7b\u65f6\uff0c\u5c31\u6ca1\u6709\u5fc5\u8981\u8ba9\u5b50\u7c7b\u518d\u53bb\u52a0\u8f7d\u4e00\u904d\uff0c\u4fdd\u8bc1\u88ab\u52a0\u8f7d\u7c7b\u7684\u552f\u4e00\u6027\u3002<\/p>\n\n\n\n<p>\u5168\u76d8\u59d4\u6258\u673a\u5236\uff1a\u5f53\u52a0\u8f7d\u4e00\u4e2a\u7c7b\u7684\u65f6\u5019\uff0c\u4f1a\u4f7f\u7528\u4e00\u4e2a\u7c7b\u52a0\u8f7d\u5668\u628a\u7c7b\u5f15\u7528\u7684\u7c7b\u90fd\u52a0\u8f7d\uff0c\u9664\u975e\u663e\u793a\u4f7f\u7528\u5176\u4ed6\u7c7b\u52a0\u8f7d\u5668\u52a0\u8f7d\u52a0\u8f7d\u5f15\u7528\u7684\u7c7b\u3002<\/p>\n\n\n\n<p><strong>\u7f3a\u70b9\uff1a\u4e0d\u5229\u4e8e\u9694\u79bb\u4e0d\u540c\u5e94\u7528\u4e2d\u7684\u540c\u540d\u7c7b\uff0c \u66f4\u65b0\u7c7b\u9700\u8981\u91cd\u542f JVM\uff0c\u56e0\u4e3a\u7236\u52a0\u8f7d\u5668\u5df2\u7ecf\u7f13\u5b58\uff0c \u70ed\u66f4\u65b0\u3001\u52a8\u6001\u6269\u5c55\u7b49\u4e0d\u65b9\u4fbf \uff0c\u5f53\u7136\u6211\u4eec\u4e5f\u53ef\u4ee5\u53bb\u6253\u7834\u8be5\u673a\u5236\uff0c\u6765\u5b9e\u73b0\u81ea\u5df1\u7684\u903b\u8f91\u3002<\/strong><\/p>\n\n\n\n<p>\u3000<\/p>\n\n\n\n<p><strong>\u6e90\u7801\u89e3\u6790<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u5728 JVM \u4e2d\uff0c\u53cc\u4eb2\u59d4\u6d3e\u673a\u5236\u662f\u7531\u00a0<code>ClassLoader<\/code>\u00a0\u62bd\u8c61\u7c7b\u5b9e\u73b0\u7684\uff0c\u6838\u5fc3\u903b\u8f91\u5728\u5b83\u7684\u00a0<code>loadClass<\/code>\u00a0\u65b9\u6cd5\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">protected Class&lt;?> loadClass(String name, boolean resolve)\n    throws ClassNotFoundException{\n    synchronized (getClassLoadingLock(name)) {\n        \/\/ 1. \u68c0\u67e5\u7c7b\u662f\u5426\u5df2\u7ecf\u88ab\u52a0\u8f7d\u8fc7\n        Class&lt;?> c = findLoadedClass(name);\n        if (c == null) {\n            long t0 = System.nanoTime();\n            try {\n                if (parent != null) {\n                     \/\/ 2. \u59d4\u6d3e\u7ed9\u7236\u52a0\u8f7d\u5668\n                    c = parent.loadClass(name, false);\n                } else {\n                    \/\/ 3. \u9876\u5c42 Bootstrap \u52a0\u8f7d\u5668\n                    c = findBootstrapClassOrNull(name);\n                }\n            } catch (ClassNotFoundException e) {\n                \/\/ \u7236\u52a0\u8f7d\u5668\u6ca1\u627e\u5230\n            }\n            if (c == null) {\n                long t1 = System.nanoTime();\n                \/\/ 4. \u7236\u52a0\u8f7d\u5668\u6ca1\u627e\u5230\uff0c\u5f53\u524d\u52a0\u8f7d\u5668\u81ea\u5df1\u52a0\u8f7d\n                c = findClass(name);\n            }\n        }\n        if (resolve) {\n            resolveClass(c);\n        }\n        return c;\n    }\n}<\/pre>\n\n\n\n<p>\u3000<\/p>\n\n\n\n<p><strong>\u6253\u7834\u53cc\u4eb2\u59d4\u6d3e<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u6253\u7834\u53cc\u4eb2\u59d4\u6d3e\u673a\u5236\u5219<strong>\u4e0d\u4ec5\u8981\u7ee7\u627fClassLoader\u7c7b\uff0c\u8fd8\u8981\u91cd\u5199loadClass\u548cfindClass\u65b9\u6cd5<\/strong>\uff0c\u5f53\u7136\u4e00\u822c\u6765\u8bf4\u901a\u5e38\u63a8\u8350\u91cd\u5199&nbsp;<code>findClass()<\/code>&nbsp;\u800c\u4e0d\u662f&nbsp;<code>loadClass()<\/code>\uff0c\u4f46\u662f\u5982\u679c\u6253\u7834\u53cc\u4eb2\u59d4\u6d3e\u8fd8\u662f\u9700\u8981\u91cd\u5199 loadClass()\u65b9\u6cd5\u3002<\/p>\n\n\n\n<p><code><strong>loadClass()<\/strong><\/code>\uff1a\u662f JVM \u5bf9\u5916\u66b4\u9732\u7684\u300c\u52a0\u8f7d\u7c7b\u300d\u5165\u53e3\u65b9\u6cd5\uff0c\u5b83\u7684\u5185\u90e8\u5b9e\u73b0\u4e86\u53cc\u4eb2\u59d4\u6d3e\u903b\u8f91\u3002<\/p>\n\n\n\n<p><code><strong>findClass()<\/strong><\/code>\uff1a\u662f\u5b50\u7c7b\u91cd\u5199\u5b9e\u73b0\u81ea\u5df1\u7684\u201c\u5bfb\u627e\u7c7b\u201d\u903b\u8f91\u201d\u7684\u94a9\u5b50\u65b9\u6cd5\uff0c\u5b83\u53ea\u8d1f\u8d23\u81ea\u5df1\u627e\u5982\u4f55\u52a0\u8f7d\uff0c\u4e0d\u7ba1\u7236\u7c7b\u903b\u8f91\uff0c\u4e0d\u5b9e\u73b0\u59d4\u6d3e\u3002<\/p>\n\n\n\n<p>loadClass \u5b9e\u73b0\u59d4\u6d3e\u903b\u8f91\uff0c\u4fdd\u8bc1\u5b89\u5168\u6027\uff0c\u5982\u679c\u5355\u7eaf\u60f3\u81ea\u5df1\u53bb\u5b9a\u4e49\u81ea\u5df1\u52a0\u8f7d\u7c7b\u7684\u65b9\u6cd5\u5c31\u5b9e\u73b0 findClass \u5373\u53ef\uff0c\u8fd9\u6837\u4e0d\u4f1a\u7834\u574f JVM \u7684\u6574\u4f53\u7c7b\u52a0\u8f7d\u903b\u8f91\uff0c\u4e5f\u4e0d\u4f1a\u610f\u5916\u8986\u76d6\u6838\u5fc3\u7c7b\u6216\u7834\u574f\u9694\u79bb\u3002<\/p>\n\n\n\n<p>\u50cf\u5728\u67d0\u4e9b\u7279\u6b8a\u573a\u666f\u4e0b\uff0c\u5982\u70ed\u52a0\u8f7d\uff0cTomcat \u7684\u5b9e\u73b0\u903b\u8f91\u5df2\u7ecf SPI \u52a0\u8f7d\u7b49\uff0c\u8fd9\u4e2a\u65f6\u5019\u5c31\u9700\u8981\u5148\u52a0\u8f7d\u81ea\u5df1\u7684\u7c7b\u800c\u4e0d\u662f\u53bb\u627e\u7236\u7c7b\u3002<\/p>\n\n\n\n<p>\u3000<\/p>\n\n\n\n<p><strong>\u603b\u7ed3<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u901a\u8fc7\u6e90\u7801\u53ef\u4ee5\u770b\u51fa\uff0c\u53cc\u4eb2\u59d4\u6d3e\u6a21\u578b\u5176\u5b9e\u5c31\u662f\u5728&nbsp;<code>loadClass<\/code>&nbsp;\u91cc\u7684\u201c\u5148\u59d4\u6d3e\u3001\u540e\u5c1d\u8bd5\u81ea\u5df1\u52a0\u8f7d\u201d\uff0c\u7b80\u5355\u7406\u89e3\u5c31\u662f\uff0c\u6709\u4e00\u4e2a\u4e8b\u60c5\u5230\u6211\u624b\u4e86\uff0c\u6211\u5148\u627e\u7236\u7c7b\u505a\uff0c\u627e\u4e0d\u5230\u518d\u81ea\u5df1\u5e72\u3002<\/p>\n\n\n\n<p>\u8fd9\u79cd\u8bbe\u8ba1\u907f\u514d\u4e86\u591a\u6b21\u52a0\u8f7d\u540c\u4e00\u4e2a\u7c7b\uff0c\u4fdd\u8bc1\u4e86\u6838\u5fc3\u7c7b\u7684\u552f\u4e00\u6027\u548c\u5b89\u5168\u6027\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8f6c\u8f7d\uff1a\u53cc\u4eb2\u59d4\u6d3e\uff1aJVM \u91cc\u90a3\u4e2a\u201c\u5148\u95ee\u7238\u7238\u201d\u7684\u7c7b\u52a0\u8f7d\u5957\u8def \u5728 JVM \u7684\u7c7b\u52a0\u8f7d\u4f53\u7cfb\u4e2d\uff0c\u53cc\u4eb2\u59d4\u6d3e\u673a\u5236\u662f\u4e00\u4e2a\u975e\u5e38\u91cd\u8981 [&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\/18450"}],"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=18450"}],"version-history":[{"count":1,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/18450\/revisions"}],"predecessor-version":[{"id":18453,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/18450\/revisions\/18453"}],"wp:attachment":[{"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=18450"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=18450"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=18450"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}