{"id":284456,"date":"2023-10-04T04:05:40","date_gmt":"2023-10-03T20:05:40","guid":{"rendered":"https:\/\/lrxjmw.cn\/lxtzkjbbnzdm.html"},"modified":"2023-10-04T04:05:40","modified_gmt":"2023-10-03T20:05:40","slug":"lxtzkjbbnzdm","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/lxtzkjbbnzdm.html","title":{"rendered":"Linux\u7cfb\u7edf\u67e5\u770bJava\u7248\u672c\uff0c\u4f60\u77e5\u9053\u5417\uff1f"},"content":{"rendered":"

1.\u80cc\u666f\u4ecb\u7ecd<\/b><\/p>\n

\u5728Linux<\/a>\u7cfb\u7edf<\/a>\u4e2dlinux\u6587\u672c\u7f16\u8f91\u5668\uff0cJava\u662f\u4e00\u79cd\u975e\u5e38\u5e38\u7528\u7684\u7f16\u7a0b\u8bed\u8a00\uff0c\u8bb8\u591a\u5e94\u7528\u7a0b\u5e8f\u90fd\u662f\u57fa\u4e8eJava\u5f00\u53d1\u7684\u3002\u56e0\u6b64\uff0c\u4e86\u89e3\u5f53\u524d\u7cfb\u7edf\u4e2d\u5b89\u88c5\u7684Java\u7248\u672c\u662f\u975e\u5e38\u91cd\u8981\u7684\u3002<\/p>\n

2.\u547d\u4ee4<\/a>\u884c\u65b9\u5f0f<\/b><\/p>\n

\u5728Linux\u7cfb\u7edf\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u6765\u67e5\u770b\u5f53\u524d\u5b89\u88c5\u7684Java\u7248\u672c\u3002\u6253\u5f00\u7ec8\u7aef\uff0c\u5e76\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n

\n

\n   java -version\n   <\/pre>\n<\/p>\n

\u8fd0\u884c\u8be5\u547d\u4ee4\u540e\uff0c\u7cfb\u7edf\u4f1a\u663e\u793a\u5f53\u524d\u5b89\u88c5\u7684Java\u7248\u672c\u4fe1\u606f\uff0c\u5305\u62ecJava\u7248\u672c\u53f7\u4ee5\u53ca\u5176\u4ed6\u76f8\u5173\u4fe1\u606f\u3002<\/p>\n

3.\u56fe\u5f62\u754c\u9762\u65b9\u5f0f<\/b><\/p>\n

\u5982\u679c\u4f60\u66f4\u559c\u6b22\u4f7f\u7528\u56fe\u5f62\u754c\u9762\u6765\u8fdb\u884c\u64cd\u4f5c\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u7cfb\u7edf\u8bbe\u7f6e\u6765\u67e5\u770bJava\u7248\u672c\u3002\u5177\u4f53\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n

-\u6253\u5f00“\u8bbe\u7f6e”\u83dc\u5355\u3002<\/p>\n

-\u5728\u8bbe\u7f6e\u83dc\u5355\u4e2d\u627e\u5230“\u5173\u4e8e”\u6216\u8005“\u7cfb\u7edf\u4fe1\u606f”\u9009\u9879\u3002<\/p>\n

-\u5728\u5173\u4e8e\u6216\u8005\u7cfb\u7edf\u4fe1\u606f\u9875\u9762\u4e2d\uff0c\u4f60\u53ef\u4ee5\u627e\u5230\u6709\u5173\u7cfb\u7edf\u548c\u8f6f\u4ef6\u7684\u8be6\u7ec6\u4fe1\u606f\uff0c\u5176\u4e2d\u4e5f\u5305\u62ecJava\u7684\u7248\u672c\u4fe1\u606f\u3002<\/p>\n

4.\u68c0\u67e5\u73af\u5883\u53d8\u91cf<\/a><\/b><\/p>\n

\u5728Linux\u7cfb\u7edf\u4e2d\uff0c\u6211\u4eec\u8fd8\u53ef\u4ee5\u901a\u8fc7\u68c0\u67e5\u73af\u5883\u53d8\u91cf\u6765\u786e\u5b9a\u5f53\u524d\u4f7f\u7528\u7684Java\u7248\u672c\u3002\u73af\u5883\u53d8\u91cf\u662f\u4e00\u4e9b\u5168\u5c40\u914d\u7f6e\u53c2\u6570\uff0c\u5728\u547d\u4ee4\u884c\u548c\u7a0b\u5e8f\u8fd0\u884c\u65f6\u8d77\u4f5c\u7528\u3002\u5177\u4f53\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n

-\u6253\u5f00\u7ec8\u7aeflinux\u8ba4\u8bc1\uff0c\u5e76\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n

\n

\n   echo $JAVA_HOME\n   <\/pre>\n<\/p>\n

-\u8fd0\u884c\u8be5\u547d\u4ee4\u540e\uff0c\u7cfb\u7edf\u4f1a\u663e\u793a\u5f53\u524d\u914d\u7f6e\u7684Java\u73af\u5883\u53d8\u91cf\u8def\u5f84\uff0c\u5305\u62ecJava\u5b89\u88c5\u76ee\u5f55\u548c\u7248\u672c\u4fe1\u606f\u3002<\/p>\n

5.\u901a\u8fc7\u5305\u7ba1\u7406\u5668\u67e5\u770b<\/b><\/p>\n

\u5728\u4e00\u4e9bLinux\u53d1\u884c\u7248\u4e2d\uff0c\u6211\u4eec\u8fd8\u53ef\u4ee5\u901a\u8fc7\u5305\u7ba1\u7406\u5668\u6765\u67e5\u770b\u5f53\u524d\u5b89\u88c5\u7684Java\u7248\u672c\u3002\u4e0d\u540c\u7684\u53d1\u884c\u7248\u6709\u4e0d\u540c\u7684\u5305\u7ba1\u7406\u5668\uff0c\u5177\u4f53\u547d\u4ee4\u53ef\u80fd\u4f1a\u6709\u6240\u5dee\u5f02\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u89c1\u53d1\u884c\u7248\u7684\u793a\u4f8b\u547d\u4ee4\uff1a<\/p>\n

- Debian\/Ubuntu\uff1a<\/p>\n

\n

\n   apt show openjdk-11-jre\n   <\/pre>\n<\/p>\n

- CentOS\/RHEL\uff1a<\/p>\n

\n

\n   yum info java-11-openjdk\n   <\/pre>\n<\/p>\n

\u8fd0\u884c\u76f8\u5e94\u7684\u547d\u4ee4\u540elinux\u7cfb\u7edf\u67e5\u770bjava\u7248\u672c<\/strong>\uff0c\u7cfb\u7edf\u4f1a\u663e\u793a\u5f53\u524d\u5b89\u88c5\u7684Java\u7248\u672c\u4fe1\u606f\u4ee5\u53ca\u5176\u4ed6\u76f8\u5173\u4fe1\u606f\u3002<\/p>\n

6.\u67e5\u770b\u9ed8\u8ba4Java\u7248\u672c<\/b><\/p>\n

\u5728\u4e00\u4e9b\u60c5\u51b5\u4e0b\uff0c\u7cfb\u7edf\u53ef\u80fd\u5b89\u88c5\u4e86\u591a\u4e2a\u7248\u672c\u7684Java\u3002\u5982\u679c\u4f60\u60f3\u77e5\u9053\u7cfb\u7edf\u9ed8\u8ba4\u4f7f\u7528\u54ea\u4e2a\u7248\u672c\u7684Java\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6765\u67e5\u770b\uff1a<\/p>\n

\n

\n   update-alternatives --query java\n   <\/pre>\n<\/p>\n

\u8fd0\u884c\u8be5\u547d\u4ee4\u540e\uff0c\u7cfb\u7edf\u4f1a\u663e\u793a\u9ed8\u8ba4Java\u7248\u672c\u7684\u8be6\u7ec6\u4fe1\u606flinux\u7cfb\u7edf\u67e5\u770bjava\u7248\u672c<\/strong>\uff0c\u5305\u62ec\u8def\u5f84\u3001\u4f18\u5148\u7ea7\u7b49\u3002<\/p>\n

7.\u5347\u7ea7Java\u7248\u672c<\/b><\/p>\n

\u5982\u679c\u4f60\u53d1\u73b0\u5f53\u524d\u5b89\u88c5\u7684Java\u7248\u672c\u8fc7\u65e7\u6216\u8005\u6709\u5176\u4ed6\u539f\u56e0\u9700\u8981\u5347\u7ea7\uff0c\u53ef\u4ee5\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u8fdb\u884c\u64cd\u4f5c\uff1a<\/p>\n

-\u6253\u5f00\u7ec8\u7aef\uff0c\u5e76\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u6765\u66f4\u65b0\u5305\u5217\u8868\uff1a<\/p>\n

\n

\n   sudo apt update\n   <\/pre>\n<\/p>\n

-\u7136\u540e\uff0c\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u6765\u5347\u7ea7Java\uff1a<\/p>\n

\n

\n   sudo apt upgrade openjdk-11-jre\n   <\/pre>\n<\/p>\n

\u8fd0\u884c\u4ee5\u4e0a\u547d\u4ee4\u540e\uff0c\u7cfb\u7edf\u4f1a\u81ea\u52a8\u4e0b\u8f7d\u548c\u5b89\u88c5\u6700\u65b0\u7248\u672c\u7684Java\u3002<\/p>\n

8.\u53c2\u8003\u6587\u6863<\/b><\/p>\n

\u5982\u679c\u4f60\u5bf9Java\u7248\u672c\u7ba1\u7406\u8fd8\u6709\u5176\u4ed6\u7591\u95ee\uff0c\u53ef\u4ee5\u53c2\u8003\u4ee5\u4e0b\u5b98\u65b9\u6587\u6863\uff1a<\/p>\n

-Oracle Java\u5b98\u65b9\u7f51\u7ad9<\/a><\/p>\n

-OpenJDK\u5b98\u65b9\u7f51\u7ad9<\/a><\/p>\n

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

\u901a\u8fc7\u672c\u6587\u4ecb\u7ecd\u7684\u51e0\u79cd\u65b9\u5f0f\uff0c\u4f60\u53ef\u4ee5\u8f7b\u677e\u5730\u5728Linux\u7cfb\u7edf\u4e2d\u67e5\u770b\u5f53\u524d\u5b89\u88c5\u7684Java\u7248\u672c\u3002\u65e0\u8bba\u662f\u547d\u4ee4\u884c\u65b9\u5f0f\u8fd8\u662f\u56fe\u5f62\u754c\u9762\u65b9\u5f0f\uff0c\u90fd\u80fd\u5e2e\u52a9\u4f60\u5feb\u901f\u4e86\u89e3\u7cfb\u7edf\u4e2d\u7684Java\u73af\u5883\u3002\u5982\u679c\u9700\u8981\u5347\u7ea7Java\u7248\u672c\uff0c\u4e5f\u53ef\u4ee5\u6309\u7167\u672c\u6587\u4e2d\u7684\u6b65\u9aa4\u8fdb\u884c\u64cd\u4f5c\u3002\u5e0c\u671b\u672c\u6587\u5bf9\u4f60\u6709\u6240\u5e2e\u52a9\uff01<\/p>\n

10.\u5173\u4e8e\u4f5c\u8005<\/b><\/p>\n

\u4f5c\u8005\u662f\u4e00\u540d\u70ed\u7231\u6280\u672f\u7684\u7a0b\u5e8f\u5458\uff0c\u5bf9Linux\u7cfb\u7edf\u548cJava\u7f16\u7a0b\u6709\u7740\u4e30\u5bcc\u7684\u7ecf\u9a8c\u3002\u5e0c\u671b\u901a\u8fc7\u5206\u4eab\u81ea\u5df1\u7684\u77e5\u8bc6\uff0c\u80fd\u591f\u5e2e\u52a9\u66f4\u591a\u7684\u4eba\u5b66\u4e60\u548c\u4f7f\u7528Java\u3002\u5982\u679c\u4f60\u6709\u4efb\u4f55\u95ee\u9898\u6216\u8005\u5efa\u8bae\uff0c\u6b22\u8fce\u4e0e\u4f5c\u8005\u4ea4\u6d41\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u5728Linux\u7cfb\u7edf\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u6765\u67e5\u770b\u5f53\u524d\u5b89\u88c5\u7684Java\u7248\u672c\u3002\u5982\u679c\u4f60\u66f4\u559c\u6b22\u4f7f\u7528\u56fe\u5f62\u754c\u9762\u6765\u8fdb\u884c\u64cd\u4f5c\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u7cfb\u7edf\u8bbe\u7f6e\u6765\u67e5\u770bJava\u7248\u672c\u3002-\u5728\u5173\u4e8e\u6216\u8005\u7cfb\u7edf\u4fe1\u606f\u9875\u9762\u4e2d\uff0c\u4f60\u53ef\u4ee5\u627e\u5230\u6709\u5173\u7cfb\u7edf\u548c\u8f6f\u4ef6\u7684\u8be6\u7ec6\u4fe1\u606f\uff0c\u5176\u4e2d\u4e5f\u5305\u62ecJava\u7684\u7248\u672c\u4fe1\u606f\u3002java-11-openjdk\u5982\u679c\u4f60\u60f3\u77e5\u9053\u7cfb\u7edf\u9ed8\u8ba4\u4f7f\u7528\u54ea\u4e2a\u7248\u672c\u7684Java\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6765\u67e5\u770b\uff1a\u8fd0\u884c\u4ee5\u4e0a\u547d\u4ee4\u540e\uff0c\u7cfb\u7edf\u4f1a\u81ea\u52a8\u4e0b\u8f7d\u548c\u5b89\u88c5\u6700\u65b0\u7248\u672c\u7684Java\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[988],"tags":[999],"class_list":["post-284456","post","type-post","status-publish","format-standard","hentry","category-tougao","tag-999"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/284456","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=284456"}],"version-history":[{"count":0,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/284456\/revisions"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=284456"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=284456"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=284456"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}