{"id":11926,"date":"2023-03-18T22:05:26","date_gmt":"2023-03-18T14:05:26","guid":{"rendered":"https:\/\/www.linuxcool.com\/lmlazjqsss"},"modified":"2023-03-18T22:05:26","modified_gmt":"2023-03-18T14:05:26","slug":"lmlazjqsss","status":"publish","type":"post","link":"https:\/\/www.linuxcool.com\/lmlazjqsss","title":{"rendered":"Linux\u547d\u4ee4\u5b89\u88c5JDK\uff0c\u8f7b\u677e\u4e0a\u624b\uff01"},"content":{"rendered":"<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>JDK\u662fJava\u5f00\u53d1\u73af\u5883\u7684\u7f29\u5199\uff0c\u5b83\u5305\u542b\u4e86JRE\u548c\u4e00\u4e9b\u5f00\u53d1\u5de5\u5177\uff0c\u5982Java\u7f16\u8bd1\u5668\u3001\u8c03\u8bd5\u5668\u3001\u6587\u6863\u751f\u6210\u5668\u7b49\u3002\u5728<a style='color:#0000CC' href='https:\/\/www.linuxprobe.com\/' target='_blank' rel=\"noopener\">Linux<\/a><a style='color:#0000CC' href='https:\/\/www.linuxdown.com\/' target='_blank' rel=\"noopener\">\u7cfb\u7edf<\/a>\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7<a style='color:#0000CC' href='https:\/\/www.linuxcool.com\/' target='_blank' rel=\"noopener\">\u547d\u4ee4<\/a>\u884c\u6765\u5b89\u88c5JDK\u3002\u672c\u6587\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528Linux\u547d\u4ee4\u5b89\u88c5JDK\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>1.\u4e0b\u8f7dJDK\u5b89\u88c5\u5305<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u9996\u5148\uff0c\u6211\u4eec\u9700\u8981\u4eceOracle\u5b98\u7f51\u4e0b\u8f7d\u9002\u7528\u4e8eLinux\u7cfb\u7edf\u7684JDK\u5b89\u88c5\u5305\u3002\u5728\u4e0b\u8f7d\u9875\u9762\u4e2d\u9009\u62e9\u9002\u5408\u60a8\u7cfb\u7edf\u7684\u7248\u672c\uff0c\u5e76\u70b9\u51fb&ldquo;\u4e0b\u8f7d&rdquo;\u6309\u94ae\u8fdb\u884c\u4e0b\u8f7d\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>2.\u89e3\u538b\u7f29JDK\u5b89\u88c5\u5305<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u4e0b\u8f7d\u5b8c\u6210\u540e\uff0c\u6211\u4eec\u9700\u8981\u89e3\u538b\u7f29\u8be5\u5b89\u88c5\u5305\u3002\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u89e3\u538b\u7f29\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\n<pre>\ntar -zxvf jdk-16_linux-x64_bin.tar.gz\n<\/pre>\n<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5176\u4e2d\uff0c&ldquo;jdk-16_linux-x64_bin.tar.gz&rdquo;\u4e3a\u60a8\u4e0b\u8f7d\u7684\u6587\u4ef6\u540d\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>3.\u79fb\u52a8\u89e3\u538b\u540e\u7684\u6587\u4ef6\u5939<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u89e3\u538b\u7f29\u540e\uff0c\u4f1a\u5f97\u5230\u4e00\u4e2a\u540d\u4e3a&ldquo;jdk-16&rdquo;\u7684\u6587\u4ef6\u5939\u3002\u6211\u4eec\u9700\u8981\u5c06\u5176\u79fb\u52a8\u5230\u4e00\u4e2a\u5408\u9002\u7684\u4f4d\u7f6e\u3002\u4f8b\u5982\uff0c\u5c06\u5176\u79fb\u52a8\u5230&ldquo;\/usr\/local\/&rdquo;\u76ee\u5f55\u4e0b\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\n<pre>\nsudo mv jdk-16 \/usr\/local\/\n<\/pre>\n<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u6ce8\u610f\uff1a\u4e0a\u9762\u7684\u547d\u4ee4\u9700\u8981\u4f7f\u7528root\u6743\u9650\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>4.\u914d\u7f6e\u73af\u5883\u53d8\u91cf<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u4e3a\u4e86\u80fd\u591f\u5728\u4efb\u4f55\u4f4d\u7f6e\u4f7f\u7528Java\u547d\u4ee4\uff0c\u6211\u4eec\u9700\u8981\u914d\u7f6e\u73af\u5883\u53d8\u91cf\u3002\u6253\u5f00&ldquo;\/etc\/profile&rdquo;\u6587\u4ef6\uff0c\u5e76\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\n<pre>\nexport JAVA_HOME=\/usr\/local\/jdk-16\nexport PATH=$JAVA_HOME\/bin:$PATH\n<\/pre>\n<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u4fdd\u5b58\u5e76\u9000\u51fa\u6587\u4ef6linux \u5b89\u88c5\uff0c\u5e76\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u4f7f\u5176\u751f\u6548\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\n<pre>\nsource \/etc\/profile\n<\/pre>\n<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u73b0\u5728<strong>linux\u547d\u4ee4\u5b89\u88c5jdk<\/strong>\uff0c\u60a8\u53ef\u4ee5\u5728\u4efb\u4f55\u4f4d\u7f6e\u4f7f\u7528Java\u548cJavac\u547d\u4ee4\u4e86\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>5.\u6d4b\u8bd5\u662f\u5426\u5b89\u88c5\u6210\u529f<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u4e3a\u4e86\u6d4b\u8bd5\u662f\u5426\u6210\u529f\u5b89\u88c5\u4e86JDK\uff0c\u8bf7\u5c1d\u8bd5\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\n<pre>\njava -version\n<\/pre>\n<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5982\u679c\u663e\u793a\u51faJava\u7248\u672c\u4fe1\u606flinux vi\uff0c\u5219\u8bf4\u660e\u5df2\u7ecf\u6210\u529f\u5b89\u88c5\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>6.\u8bbe\u7f6e\u9ed8\u8ba4Java\u7248\u672c<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5982\u679c\u60a8\u7cfb\u7edf\u4e2d\u540c\u65f6\u5b58\u5728\u591a\u4e2a\u7248\u672c\u7684Java\uff0c\u5219\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u8bbe\u7f6e\u9ed8\u8ba4\u7248\u672c\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\n<pre>\nsudo update-alternatives --config java\n<\/pre>\n<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u7136\u540e\u9009\u62e9\u60a8\u60f3\u8981\u8bbe\u7f6e\u4e3a\u9ed8\u8ba4\u7248\u672c\u7684Java\u5373\u53ef\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>7.\u5378\u8f7dJDK<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5982\u679c\u60a8\u4e0d\u518d\u9700\u8981\u67d0\u4e2a\u7248\u672c\u7684JDK<strong>linux\u547d\u4ee4\u5b89\u88c5jdk<\/strong>\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u8fdb\u884c\u5378\u8f7d\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\n<pre>\nsudo rm -rf \/usr\/local\/jdk-16\/\nsudo vim \/etc\/profile #\u5220\u9664\u4e4b\u524d\u6dfb\u52a0\u7684\u4e24\u884c\u4ee3\u7801\nsource \/etc\/profile #\u4f7f\u66f4\u6539\u751f\u6548\n<\/pre>\n<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>8.\u603b\u7ed3<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u672c\u6587\u4ecb\u7ecd\u4e86\u5982\u4f55\u4f7f\u7528Linux\u547d\u4ee4\u6765\u5b89\u88c5JDK\uff0c\u5e76\u4e14\u8bb2\u89e3\u4e86\u4e00\u4e9b\u5e38\u89c1\u95ee\u9898\u3002\u5e0c\u671b\u80fd\u591f\u5bf9\u60a8\u6709\u6240\u5e2e\u52a9\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728Linux\u7cfb\u7edf\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u6765\u5b89\u88c5JDK\u3002\u672c\u6587\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528Linux\u547d\u4ee4\u5b89\u88c5JDK\u3002\u4e0b\u8f7d\u5b8c\u6210\u540e\uff0c\u6211\u4eec\u9700\u8981\u89e3\u538b\u7f29\u8be5\u5b89\u88c5\u5305\u3002\u6ce8\u610f\uff1a\u4e0a\u9762\u7684\u547d\u4ee4\u9700\u8981\u4f7f\u7528root\u6743\u9650\u3002\u73b0\u5728\uff0c\u60a8\u53ef\u4ee5\u5728\u4efb\u4f55\u4f4d\u7f6e\u4f7f\u7528Java\u548cJavac\u547d\u4ee4\u4e86\u3002\u4e3a\u4e86\u6d4b\u8bd5\u662f\u5426\u6210\u529f\u5b89\u88c5\u4e86JDK\uff0c\u8bf7\u5c1d\u8bd5\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a\u5982\u679c\u60a8\u4e0d\u518d\u9700\u8981\u67d0\u4e2a\u7248\u672c\u7684JDK\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u8fdb\u884c\u5378\u8f7d\uff1a<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[224,23,151],"class_list":["post-11926","post","type-post","status-publish","format-standard","hentry","category-knowledge","tag-j","tag-lxt","tag-s-5"],"_links":{"self":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/11926","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/comments?post=11926"}],"version-history":[{"count":0,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/11926\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media?parent=11926"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/categories?post=11926"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/tags?post=11926"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}