{"id":290572,"date":"2024-03-28T21:26:56","date_gmt":"2024-03-28T13:26:56","guid":{"rendered":"https:\/\/lrxjmw.cn\/lbbsbsjnpzjh.html"},"modified":"2024-03-28T21:26:56","modified_gmt":"2024-03-28T13:26:56","slug":"lbbsbsjnpzjh","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/lbbsbsjnpzjh.html","title":{"rendered":"Linux\u5fc5\u5907\uff01\u624b\u628a\u624b\u6559\u4f60\u914d\u7f6eJDK\u73af\u5883\uff0c\u89e3\u9501Java\u5f00\u53d1\u65b0\u59ff\u52bf"},"content":{"rendered":"

\u5728Linux<\/a>\u73af\u5883\u4e0b\uff0c\u914d\u7f6eJDK\u5e73\u53f0\u4e43\u662f\u5f00\u53d1\u4eba\u5458\u53ca\u7ba1\u7406\u5458\u5e38\u9700\u6267\u884c\u7684\u4efb\u52a1\u4e4b\u4e00\u3002\u9002\u5f53\u8c03\u8282\u7684JDK\u73af\u5883\u80fd\u591f\u6709\u6548\u5730\u5e2e\u52a9\u6211\u4eec\u5728\u7cfb\u7edf<\/a>\u5185\u7a33\u5b9a\u8fd0\u884cJava\u5e94\u7528\u7a0b\u5e8f\u5e76\u8fdb\u884c\u5f00\u53d1\u548c\u8c03\u8bd5\u5de5\u4f5c\u3002\u672c\u6587\u5c06\u6df1\u5165\u63a2\u8ba8\u5982\u4f55\u5728Linux\u7cfb\u7edf\u4e0a\u914d\u7f6eJDK\u73af\u5883\u7684\u8be6\u7ec6\u6b65\u9aa4\uff0c\u5305\u62ec\u4e0b\u8f7dJDK\u5b89\u88c5\u5305\u548c\u8bbe\u7f6e\u76f8\u5173\u73af\u5883\u53d8\u91cf\u7b49\u7ec6\u8282\u5185\u5bb9\uff0c\u4ee5\u671f\u4e3a\u8bfb\u8005\u63d0\u4f9b\u5b9e\u7528\u6307\u5357\u3002<\/p>\n

1.\u4e0b\u8f7dJDK\u5b89\u88c5\u5305<\/b><\/p>\n

\u9996\u8981\u524d\u63d0\u662f\uff0c\u5fc5\u987b\u4ece\u5b98\u65b9\u6216\u53ef\u9760\u7684\u7f51\u7ad9\u83b7\u53d6\u9002\u5408Linux\u64cd\u4f5c\u7cfb\u7edf\u7684JDK\u7248\u672c\u3002\u9009\u62e9\u4f55\u79cd\u9002\u5f53\u7684JDK\u7248\u672c\uff0c\u8fd8\u9700\u8981\u6839\u636e\u5b9e\u9645\u5f00\u53d1\u9700\u6c42\u548c\u9879\u76ee\u8981\u6c42\u8fdb\u884c\u5ba1\u614e\u7684\u659f\u914c\u3002\u4e00\u822c\u800c\u8a00\uff0c\u53ef\u80fd\u4f1a\u9047\u5230Oracle JDK\u548cOpenJDK\u4e24\u79cd\u9009\u62e9\uff0c\u5efa\u8bae\u6839\u636e\u4e2a\u4eba\u5174\u8da3\u4ee5\u53ca\u9700\u6c42\u6765\u51b3\u5b9a\u3002<\/p>\n

\u5b8c\u6210\u4e0b\u8f7d\u540e\uff0c\u52a1\u5fc5\u5c06\u76f8\u5173\u5b89\u88c5\u6587\u4ef6\u59a5\u5584\u5f52\u7f6e\u81f3\u4e13\u95e8\u7684\u6587\u4ef6\u5939\uff0c\u4ee5\u4fbf\u4e8e\u540e\u7eed\u64cd\u4f5c\u3002\u63a5\u4e0b\u6765\uff0c\u5373\u53ef\u5f00\u59cb\u8fdb\u884cJDK\u7684\u90e8\u7f72\u4ee5\u53ca\u73af\u5883\u7684\u76f8\u5e94\u914d\u7f6e\u3002<\/p>\n

2.\u5b89\u88c5JDK<\/b><\/p>\n

\u9996\u8981\u4efb\u52a1\u662f\u89e3\u538b\u7f29\u5df2\u5b8c\u6210\u4e0b\u8f7d\u7684JDK\u5b89\u88c5\u7a0b\u5e8f\u3002\u53ef\u4ee5\u901a\u8fc7\u7cfb\u7edf\u81ea\u5e26\u7ec8\u7aef\u5185\u7684tar\u547d\u4ee4<\/a>\u8fdb\u884c\u5904\u7406\uff0c\u4e5f\u53ef\u4ee5\u91c7\u7528\u684c\u9762\u73af\u5883\u4e2d\u7684\u76f8\u5173\u529f\u80fd\u5b8c\u6210\u6b64\u9879\u5de5\u4f5c\u3002\u7ecf\u8fc7\u89e3\u538b\u7f29\u4e4b\u540e\uff0c\u4fbf\u80fd\u5f97\u5230\u4e00\u4e2a\u540d\u4e3a\u201cjdk\u201d\u7684\u6587\u4ef6\u5939\uff0c\u5176\u5185\u90e8\u5305\u62ec\u5404\u79cdJava\u5f00\u53d1\u6240\u9700\u7684\u5de5\u5177\u548c\u8fd0\u884c\u65f6\u5e93\u7b49\u3002<\/p>\n

\u63a5\u4e0b\u6765\u7684\u6b65\u9aa4\u4fbf\u662f\u7cbe\u786e\u8c03\u6574\u4e24\u4e2a\u91cd\u8981\u7684\u73af\u5883\u53c2\u6570\uff1a\u5373\u8bbe\u7f6e\u5408\u9002\u7684JAVA_HOME\u6807\u5fd7\u4f4d\u6765\u5b9a\u4f4d\u548c\u8bc6\u522b\u51faJDK\u7684\u5b89\u88c5\u8def\u5f84linux\u547d\u4ee4\u5927\u5168\uff0c\u518d\u6709\u5c31\u662f\u4ed4\u7ec6\u8c03\u8282PATH\u53d8\u91cflinux\u914d\u7f6ejdk\u73af\u5883<\/strong>\uff0c\u4f7f\u5f97Java\u7a0b\u5e8f\u80fd\u591f\u5728\u6b63\u786e\u7684\u8fd0\u884c\u8def\u5f84\u4e2d\u88ab\u6210\u529f\u7d22\u5f15\u5e76\u6267\u884c\u3002<\/p>\n

3.\u914d\u7f6e\u73af\u5883\u53d8\u91cf<\/b><\/p>\n

\u60a8\u53ef\u4ee5\u53c2\u7167\u672c\u6307\u5f15\u5bf9\u76f8\u5e94Shell\uff08\u5982Bash\u6216\u8005ZSH\uff09\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u4f8b\u5982bashrc\u548czshrc\u8fdb\u884c\u5b9a\u5236\u5316\u8bbe\u7f6e\u3002\u4e4b\u540e\u6309\u7167\u4ee5\u4e0b\u64cd\u4f5c\u6b65\u9aa4\u6267\u884c\u5373\u53ef\u3002<\/p>\n

\u8bf7\u6b63\u786e\u8bbe\u5b9aJava\u73af\u5883\u53d8\u91cf\uff0c\u5c06\u5176\u503c\u8bbe\u4e3a\"\/path\/to\/your\/jdk\"\u3002<\/p>\n

\u914d\u7f6e\u73af\u5883\u53d8\u91cf_\u914d\u7f6e\u73af\u5883\u662f\u4ec0\u4e48\u610f\u601d_linux\u914d\u7f6ejdk\u73af\u5883<\/p>\n

\u5728\u73af\u5883\u53d8\u91cf$PATH\u4e2d\u589e\u52a0$JAVA_HOME\/BIN\u7684\u8def\u5f84\u4fe1\u606f\u3002<\/p>\n

\u4fdd\u5b58\u6587\u4ef6\u5e76\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u4f7f\u4fee\u6539\u751f\u6548\uff1a<\/p>\n

source ~\/.bashrc<\/p>\n

\u81f3\u6b64linux\u914d\u7f6ejdk\u73af\u5883<\/strong>\uff0c\u73af\u5883\u53c2\u6570\u8c03\u6574\u5b8c\u6bd5\u3002\u901a\u8fc7\u6267\u884c\u547d\u4ee4java -version\u5373\u53ef\u786e\u8ba4JDK\u7684\u5b89\u88c5\u60c5\u51b5\u548c\u914d\u7f6e\u786e\u8ba4\u65e0\u95ee\u9898\u3002<\/p>\n

4.\u914d\u7f6e\u5176\u4ed6\u76f8\u5173\u73af\u5883\u53d8\u91cf<\/b><\/p>\n

\u914d\u7f6e\u73af\u5883\u662f\u4ec0\u4e48\u610f\u601d_\u914d\u7f6e\u73af\u5883\u53d8\u91cf_linux\u914d\u7f6ejdk\u73af\u5883<\/p>\n

\u5728\u7279\u5b9a\u5f00\u53d1\u5de5\u5177\u548c\u6846\u67b6\u7684\u8fd0\u884c\u4e2d\uff0c\u9664\u4e86 Java_Home \u548c Path \u8fd9\u4e24\u4e2a\u57fa\u672c\u73af\u5883\u53d8\u91cf\u4e4b\u5916linux site:infoq.cn\uff0c\u8fd8\u6709\u5fc5\u8981\u8bbe\u7f6e\u66f4\u591a\u7684\u73af\u5883\u53d8\u91cf\u6765\u6ee1\u8db3\u9700\u8981\u3002\u4f8b\u5982\uff0c\u4f7f\u7528 Maven \u65f6\uff0c\u6211\u4eec\u9700\u8981\u8bbe\u5b9a MAVEN_HOME\uff0c\u540c\u65f6\u8fd8\u5e94\u786e\u4fdd\u5b83\u7684 bin \u5b50\u6587\u4ef6\u5939\u88ab\u6536\u5165 Path\uff1b\u5982\u679c\u6d89\u53ca\u5230 Tom cat \u670d\u52a1\u5668\u7684\u914d\u7f6e\uff0c\u90a3\u5c31\u5f97\u786e\u5b9a CATALINA_HOME \u7684\u503c\u4e86\u3002<\/p>\n

\u6839\u636e\u5b9e\u9645\u548c\u9879\u76ee\u9700\u6c42\u7684\u53d8\u5316\uff0c\u6211\u4eec\u5e94\u5ba2\u89c2\u5730\u8c03\u6574\u73af\u5883\u53d8\u91cf\u8bbe\u7f6e\u4ee5\u7ef4\u7cfb\u9879\u76ee\u7684\u7a33\u5b9a\u8fd0\u884c\u53ca\u63d0\u5347\u7814\u53d1\u6548\u7387\u3002<\/p>\n

5.\u9a8c\u8bc1\u914d\u7f6e<\/b><\/p>\n

\u786e\u8ba4\u914d\u7f6e\u6b63\u786e\u6027\uff0c\u53ef\u4ee5\u4f7f\u7528ksh\u6216cmd\u7ec8\u7aef\u8f93\u5165\"java -version\"\u548c\"javac -version\"\u6765\u67e5\u770b\u5e76\u9a8c\u8bc1Java\u8fd0\u884c\u73af\u5883\u4e0e\u7f16\u8bd1\u5668\u7684\u7248\u672c\u4fe1\u606f\u3002\u82e5\u90fd\u80fd\u83b7\u53d6\u5230\u7248\u672c\u8baf\u606f\uff0c\u8868\u793a\u6210\u529f\u6784\u5efa\u4e86JDK\u73af\u5883\u3002<\/p>\n

\u5728\u8fd9\u4e2a\u8fc7\u7a0b\u4e2d\uff0c\u6211\u4eec\u4f1a\u91c7\u7528\u7b80\u7ea6\u7684\"Hello World\"\u7a0b\u5e8f\u6765\u68c0\u67e5\u548c\u786e\u8ba4\u5f00\u53d1\u73af\u5883\u7684\u7a33\u5b9a\u6027\u4e0e\u53ef\u9760\u6027\uff0c\u540c\u65f6\u719f\u6089\u5e76\u638c\u63e1Java\u5f00\u53d1\u5de5\u5177\u7684\u5404\u9879\u529f\u80fd\u3002<\/p>\n

\u914d\u7f6e\u73af\u5883\u53d8\u91cf_linux\u914d\u7f6ejdk\u73af\u5883_\u914d\u7f6e\u73af\u5883\u662f\u4ec0\u4e48\u610f\u601d<\/p>\n

6.\u66f4\u65b0\u548c\u5347\u7ea7<\/b><\/p>\n

\u4fdd\u6301\u9891\u7e41\u66f4\u65b0\u7684Java Development Kit\uff08JDK\uff09\u7248\u672c\u81f3\u5173\u91cd\u8981\uff0c\u8fd9\u662f\u56e0\u4e3a\u65b0\u7248\u672c\u53ef\u4ee5\u8fc5\u901f\u4fee\u590d\u6f0f\u6d1e\u5e76\u4e14\u589e\u5f3a\u529f\u80fd\u53ca\u6027\u80fd\u3002\u53ca\u65f6\u66f4\u65b0\u81f3\u6700\u65b0\u7248\uff0c\u80fd\u786e\u4fdd\u6211\u4eec\u7d27\u8ddf\u6280\u672f\u524d\u6cbf\uff0c\u89c4\u907f\u6f5c\u5728\u95ee\u9898\u3002<\/p>\n

\u8bf7\u60a8\u5728\u4e0b\u8f7d\u5e76\u8fd0\u884c\u5168\u65b0\u7684JDK\u5b89\u88c5\u7a0b\u5e8f\u66f4\u9ad8\u7ea7\u522b\u540e\uff0c\u5bf9\u73b0\u6709\u73af\u5883\u8fdb\u884c\u59a5\u5f53\u7684\u5347\u7ea7\u3002\u5728\u5f00\u59cb\u6b64\u6b65\u9aa4\u524d\uff0c\u8bf7\u786e\u4fdd\u5df2\u7ecf\u4e3a\u539f\u6709\u914d\u7f6e\u6587\u4ef6\u8fdb\u884c\u4e86\u5907\u4efd\uff0c\u4ee5\u9632\u53ef\u80fd\u51fa\u73b0\u7684\u95ee\u9898\u5bfc\u81f4\u6574\u4e2a\u5f00\u53d1\u73af\u5883\u7684\u762b\u75ea\u3002<\/p>\n

7.\u6545\u969c\u6392\u9664\u4e0e\u5e38\u89c1\u95ee\u9898<\/b><\/p>\n

\u5728\u6784\u5efaJDK\u73af\u5883\u65f6\uff0c\u53ef\u80fd\u4f1a\u78b0\u5230\"Java\u65e0\u6cd5\u8bc6\u522b\"\u6216\"JAVA_HOME\u672a\u88ab\u53d1\u73b0\"\u7b49\u95ee\u9898\u3002\u6b64\u65f6\uff0c\u5fc5\u987b\u4ed4\u7ec6\u5730\u8fdb\u884c\u6392\u67e5\u548c\u9010\u4e00\u89e3\u51b3\u76f8\u5173\u95ee\u9898\u3002<\/p>\n

\u914d\u7f6e\u73af\u5883\u662f\u4ec0\u4e48\u610f\u601d_\u914d\u7f6e\u73af\u5883\u53d8\u91cf_linux\u914d\u7f6ejdk\u73af\u5883<\/p>\n

\u8bf8\u591a\u5e38\u89c1\u95ee\u9898\u6e90\u4e8e\u8bbe\u7f6e\u4e0d\u5f53\u8def\u5f84\u3001\u6743\u9650\u5206\u5de5\u4e0d\u6e05\u3001\u8f6f\u4ef6\u7248\u672c\u4e0d\u5339\u914d\u7b49\u56e0\u7d20\u3002\u901a\u8fc7\u67e5\u770b\u7cfb\u7edf\u65e5\u5fd7\u5e76\u4fee\u6b63\u9519\u8bef\u4fe1\u606f\uff0c\u501f\u9274\u4e92\u8054\u7f51\u7c7b\u4f3c\u95ee\u9898\u7684\u89e3\u51b3\u65b9\u6848\uff0c\u80fd\u52a9\u4f60\u8fc5\u901f\u6392\u9664\u6545\u969c\u5e76\u5b8c\u6210\u9ad8\u6548\u914d\u7f6e\u3002<\/p>\n

8.\u603b\u7ed3<\/b><\/p>\n

\u7ecf\u8fc7\u7cbe\u5fc3\u89e3\u8bfb\u548c\u793a\u8303\u6027\u7684\u6307\u5bfc\uff0c\u76f8\u4fe1\u60a8\u5df2\u7ecf\u66f4\u52a0\u6df1\u5165\u5730\u7406\u89e3\u4e86\u5982\u4f55\u5728Linux\u73af\u5883\u4e0b\u642d\u5efa\u9002\u5408\u7684JDK\u73af\u5883\u3002\u4f5c\u4e3a\u4e13\u6ce8\u4e8eJava\u5f00\u53d1\u7684\u4e1a\u5185\u4eba\u58eb\uff0c\u5408\u7406\u914d\u7f6eJDK\u73af\u5883\u65e0\u7591\u662f\u5173\u952e\u4e2d\u7684\u5173\u952e\uff0c\u5728\u5b9e\u9645\u4e1a\u52a1\u9879\u76ee\u4e2d\uff0c\u8fd9\u4e00\u70b9\u7684\u4f5c\u7528\u66f4\u662f\u65e0\u53ef\u5339\u654c\u3002<\/p>\n

\u8bda\u631a\u9080\u8bf7\u5404\u4f4d\u6df1\u5165\u7814\u7a76\u548c\u5b9e\u9645\u64cd\u4f5cLinux\u7cfb\u7edf\u4ee5\u53cajava\u5f00\u53d1\u5de5\u5177\uff0c\u4ee5\u63d0\u5347\u60a8\u5bf9\u6b64\u7684\u7406\u89e3\u548c\u719f\u7ec3\u7a0b\u5ea6\u3002\u613f\u60a8\u6210\u4e3a\u6770\u51faJava\u5f00\u53d1\u8005\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"

\u7ecf\u8fc7\u89e3\u538b\u7f29\u4e4b\u540e\uff0c\u4fbf\u80fd\u5f97\u5230\u4e00\u4e2a\u540d\u4e3a\u201cjdk\u201d\u7684\u6587\u4ef6\u5939\uff0c\u5176\u5185\u90e8\u5305\u62ec\u5404\u79cdJava\u5f00\u53d1\u6240\u9700\u7684\u5de5\u5177\u548c\u8fd0\u884c\u65f6\u5e93\u7b49\u3002\u8bf7\u60a8\u5728\u4e0b\u8f7d\u5e76\u8fd0\u884c\u5168\u65b0\u7684JDK\u5b89\u88c5\u7a0b\u5e8f\u66f4\u9ad8\u7ea7\u522b\u540e\uff0c\u5bf9\u73b0\u6709\u73af\u5883\u8fdb\u884c\u59a5\u5f53\u7684\u5347\u7ea7\u3002\u5728\u5f00\u59cb\u6b64\u6b65\u9aa4\u524d\uff0c\u8bf7\u786e\u4fdd\u5df2\u7ecf\u4e3a\u539f\u6709\u914d\u7f6e\u6587\u4ef6\u8fdb\u884c\u4e86\u5907\u4efd\uff0c\u4ee5\u9632\u53ef\u80fd\u51fa\u73b0\u7684\u95ee\u9898\u5bfc\u81f4\u6574\u4e2a\u5f00\u53d1\u73af\u5883\u7684\u762b\u75ea\u3002<\/p>\n","protected":false},"author":1,"featured_media":290573,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[988],"tags":[999],"class_list":["post-290572","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tougao","tag-999"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/290572","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=290572"}],"version-history":[{"count":0,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/290572\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/290573"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=290572"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=290572"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=290572"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}