{"id":6996,"date":"2020-04-26T19:11:48","date_gmt":"2020-04-26T11:11:48","guid":{"rendered":"https:\/\/www.linuxcool.com\/?p=6996"},"modified":"2020-04-26T19:11:49","modified_gmt":"2020-04-26T11:11:49","slug":"update-alternatives","status":"publish","type":"post","link":"https:\/\/www.linuxcool.com\/update-alternatives","title":{"rendered":"update-alternatives\u547d\u4ee4 – \u7ef4\u62a4\u7cfb\u7edf\u547d\u4ee4\u94fe\u63a5\u7b26"},"content":{"rendered":"\n

update-alternatives\u662fDebian\u7cfb\u7edf\u4e2d\u4e13\u95e8\u7ef4\u62a4\u7cfb\u7edf\u547d\u4ee4\u94fe\u63a5\u7b26\u7684\u5de5\u5177\uff0c\u901a\u8fc7\u5b83\u53ef\u4ee5\u5f88\u65b9\u4fbf\u7684\u8bbe\u7f6e\u7cfb\u7edf\u9ed8\u8ba4\u4f7f\u7528\u54ea\u4e2a\u547d\u4ee4\u3001\u54ea\u4e2a\u8f6f\u4ef6\u7248\u672c\uff0c\u6bd4\u5982\u7cfb\u7edf\u4e2d\u540c\u65f6\u5b89\u88c5\u4e86open jdk\u548csun jdk\u4e24\u4e2a\u7248\u672c\uff0c\u800c\u6211\u4eec\u53c8\u5e0c\u671b\u7cfb\u7edf\u9ed8\u8ba4\u4f7f\u7528sun jdk\uff0c\u901a\u8fc7update-alternatives\u5c31\u53ef\u4ee5\u65b9\u4fbf\u5b9e\u73b0\u7ba1\u7406\u3002<\/p>\n\n\n\n

\u8bed\u6cd5\u683c\u5f0f\uff1a<\/strong>update-alternatives [\u53c2\u6570] [\u547d\u4ee4] <\/p>\n\n\n\n

\u5e38\u7528\u53c2\u6570\uff1a<\/strong><\/p>\n\n\n\n

--install<\/td>\u5728\u7cfb\u7edf\u4e2d\u52a0\u5165\u4e00\u7ec4\u66ff\u6362\u9879<\/td><\/tr>
--remove <name> <path><\/td>\u4ece\u540d\u79f0\u66ff\u6362\u7ec4\u4e2d\u53bb\u9664\u8def\u5f84\u9879<\/td><\/tr>
--auto <\/td>\u5c06\u540d\u79f0\u7684\u4e3b\u94fe\u63a5\u5207\u6362\u5230\u81ea\u52a8\u6a21\u5f0f<\/td><\/tr>
--list<\/td>\u5217\u51fa\u540d\u79f0\u66ff\u6362\u7ec4\u4e2d\u6240\u6709\u53ef\u7528\u66ff\u6362\u9879<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n

\u53c2\u8003\u5b9e\u4f8b:<\/strong><\/p>\n\n\n\n

\u5c06\u81ea\u5df1\u5b89\u88c5\u7684JDK\u8bbe\u7f6e\u4e3a\u9ed8\u8ba4\u7684JDK\u7248\u672c\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# update-alternatives --install \/usr\/bin\/java java \/usr\/lib\/jvm\/java\/bin\/java 1070\n[root@linuxcool ~]# update-alternatives --install \/usr\/bin\/javac javac \/usr\/lib\/jvm\/java\/bin\/javac 1070\n[root@linuxcool ~]# update-alternatives --install \/usr\/bin\/jar jar \/usr\/lib\/jvm\/java\/bin\/jar 1070\n[root@linuxcool ~]# update-alternatives --install \/usr\/bin\/javah javah \/usr\/lib\/jvm\/java\/bin\/javah 1070\n[root@linuxcool ~]# update-alternatives --install \/usr\/bin\/javap javap \/usr\/lib\/jvm\/java\/bin\/javap 1070<\/pre>\n\n\n\n

\u9009\u62e9\u6211\u4eec\u5b89\u88c5\u7684JDK\u7248\u672c\uff1a <\/p>\n\n\n\n

[root@linuxcool ~]# update-alternatives --config java<\/pre>\n\n\n\n

\u9009\u62e9\u6211\u4eec\u5b89\u88c5\u7684JDK\u7248\u672c\uff1a <\/p>\n\n\n\n

[root@linuxcool ~]# update-alternatives --config java<\/pre>\n\n\n\n

\u5217\u51fa\u4e3b\u8981\u5019\u9009\u9879\u540d\u79f0\u4ee5\u53ca\u5b83\u4eec\u7684\u72b6\u6001\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# update-alternatives --get-selections<\/pre>\n","protected":false},"excerpt":{"rendered":"

update-alternatives\u662fDebian\u7cfb\u7edf\u4e2d\u4e13\u95e8\u7ef4\u62a4\u7cfb\u7edf\u547d\u4ee4\u94fe\u63a5\u7b26\u7684\u5de5\u5177\uff0c\u901a\u8fc7\u5b83\u53ef\u4ee5\u5f88\u65b9\u4fbf\u7684\u8bbe\u7f6e […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[7],"tags":[],"_links":{"self":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/6996"}],"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=6996"}],"version-history":[{"count":4,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/6996\/revisions"}],"predecessor-version":[{"id":7206,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/6996\/revisions\/7206"}],"wp:attachment":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media?parent=6996"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/categories?post=6996"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/tags?post=6996"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}