{"id":267792,"date":"2023-03-23T06:08:16","date_gmt":"2023-03-22T22:08:16","guid":{"rendered":"https:\/\/lrxjmw.cn\/wxyjhsjhzjjd.html"},"modified":"2023-03-23T06:08:16","modified_gmt":"2023-03-22T22:08:16","slug":"wxyjhsjhzjjd","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/wxyjhsjhzjjd.html","title":{"rendered":"\u6211\u9700\u8981JVM\u8fd8\u662fJRE\u6216\u8005JDK\uff1fJava\u5927\u81f4\u5206\u4e3a\u4e24\u4e2a\u4e0b\u8f7d\u7c7b\u522b"},"content":{"rendered":"

\u4f5c\u8005\uff1aSethKenlon\u8bd1\u8005\uff1aLCTTXingyu.Wang<\/p>\n

|2019-11-2606:53\u6536\u85cf:2<\/p>\n

\u5728\u684c\u9762\u4e0a\u62e5\u62b1Java\u5e94\u7528\u7a0b\u5e8flinux\u8f6f\u4ef6\u5982\u4f55\u5b89\u88c5<\/strong>\uff0c\u4e4b\u540e\u5728\u6240\u6709\u684c\u9762\u4e0a\u8fd0\u884c\u5b83\u4eec\u3002<\/p>\n

\u65e0\u8bba\u4f60\u8fd0\u884c\u7684\u662f\u54ea\u79cd\u64cd\u4f5c\u7cfb\u7edf<\/a>\uff0c\u4e00\u822c\u90fd\u6709\u51e0\u79cd\u5b89\u88c5\u5e94\u7528\u7a0b\u5e8f\u7684\u6280\u5de7\u3002\u6709\u65f6\u4f60\u53ef\u80fd\u4f1a\u5728\u5e94\u7528\u7a0b\u5e8f\u5546\u5e97\u4e2d\u627e\u5230\u4e00\u4e2a\u5e94\u7528\u7a0b\u5e8f\uff0c\u6216\u5219\u4f7f\u7528Fedora\u4e0a\u7684DNF\u6216Mac\u4e0a\u7684Brew\u8fd9\u6837\u7684\u8f6f\u4ef6\u5305\u7ba1\u7406\u5668\u8fdb\u884c\u5b89\u88c5\uff0c\u800c\u6709\u65f6\u4f60\u53ef\u80fd\u4f1a\u4ece\u7f51\u7ad9\u4e0a\u4e0b\u8f7d\u53ef\u6267\u884c\u6587\u4ef6\u6216\u5b89\u88c5\u7a0b\u5e8f\u3002\u7531\u4e8eJava\u662f\u90a3\u4e48\u591a\u6d41\u884c\u7684\u5e94\u7528\u7a0b\u5e8f\u7684\u524d\u7aef\uff0c\u6240\u4ee5\u6700\u597d\u4e86\u89e3\u5b89\u88c5\u5b83\u7684\u4e0d\u540c\u65b9\u5f0f\u3002\u597d\u6d88\u606f\u662f\u4f60\u6709\u597d\u591a\u9009\u62e9\uff0c\u672c\u6587\u56ca\u62ec\u4e86\u6240\u6709\u90a3\u4e9b\u5185\u5bb9\u3002<\/p>\n

\u574f\u6d88\u606f\u662fJava\u592a\u5927\uff0c\u6211\u8bf4\u7684\u4e0d\u4ec5\u4ec5\u662f\u6587\u4ef6\u5927\u5c0f\u3002Java\u662f\u4e00\u79cd\u5f00\u653e\u6e90\u4ee3\u7801\u8bed\u8a00\u548c\u89c4\u8303\uff0c\u8fd9\u610f\u5473\u7740\u4ece\u7406\u8bba\u4e0a\u8bb2\uff0c\u4efb\u4f55\u4eba\u90fd\u53ef\u4ee5\u521b\u5efa\u5b83\u7684\u5b9e\u73b0\u7248\u672c\u3002\u8fd9\u610f\u5473\u7740\uff0c\u5728\u5b89\u88c5\u4efb\u4f55\u4e1c\u897f\u4e4b\u524d\uff0c\u5fc5\u987b\u786e\u5b9a\u8981\u5b89\u88c5\u7684Java\u53d1\u884c\u7248\u3002<\/p>\n

\u6211\u987b\u8981JVM\u8fd8\u662fJRE\u6216\u5219JDK\uff1f<\/p>\n

Java\u5927\u81f4\u5206\u4e3a\u4e24\u4e2a\u4e0b\u8f7d\u7c7b\u522b\u3002Java\u865a\u62df\u673aJavaVirtualMachine\uff08JVM\uff09\u662f\u8fd0\u884c\u65f6\u7ec4\u4ef6\uff1b\u5b83\u662f\u4f7fJava\u5e94\u7528\u7a0b\u5e8f\u624d\u80fd\u5728\u8ba1\u7b97\u673a\u4e0a\u542f\u52a8\u548c\u8fd0\u884c\u7684\u201c\u5f15\u64ce\u201d\u3002\u5b83\u5305\u542b\u5728Java\u8fd0\u884c\u65f6\u73af\u5883JavaRuntimeEnvironment\uff08JRE\uff09\u4e2d\u3002<\/p>\n

Java\u5f00\u53d1\u5de5\u5177\u5305JavaDevelopmentKit\uff08JDK\uff09\u662f\u4e00\u4e2a\u5f00\u53d1\u5de5\u5177\u5305\uff1a\u4f60\u53ef\u4ee5\u5c06\u5176\u89c6\u4e3a\u4e00\u4e2a\u8f66\u5e93\uff0c\u7ef4\u4fee\u5de5\u53ef\u4ee5\u5750\u5728\u90a3\u513f\u8fdb\u884c\u8c03\u6574\u3001\u4fee\u7406\u548c\u6539\u8fdb\u3002JDK\u5305\u542bJava\u8fd0\u884c\u65f6\u73af\u5883\uff08JRE\uff09\u3002<\/p>\n

\u4ee5\u4e0b\u8f7d\u6765\u8bf4\uff0c\u8fd9\u610f\u5473\u7740\uff1a<\/p>\n

\u5f53\u592a\u9633\u5fae\u7cfb\u7edfSunMicrosystems\u88abOracle\u7ade\u8d2d\u65f6\uff0cJava\u662f\u8be5\u4ea4\u6613\u7684\u4e3b\u8981\u90e8\u4efd\u3002\u8f9b\u8fd0\u7684\u662f\uff0cJava\u662f\u4e00\u79cd\u5f00\u6e90\u6280\u672f\uff0c\u56e0\u800c\uff0c\u5047\u5982\u4f60\u5bf9Oracle\u7ef4\u62a4\u8be5\u9879\u76ee\u7684\u5f62\u5f0f\u4e0d\u6ee1\u610f\uff0c\u5219\u53ef\u4ee5\u9009\u62e9\u5176\u4ed6\u65b9\u5f0f\u3002Oracle\u5c06\u4e13\u6709\u7ec4\u4ef6\u4e0eJava\u4e0b\u8f7d\u6346\u7ed1\u5728\u4e00\u8d77\uff0c\u800cOpenJDK\u9879\u76ee\u662f\u5b8c\u5168\u5f00\u6e90\u7684\u3002<\/p>\n

IcedTea\u9879\u76ee\u672c\u8d28\u4e0a\u662fOpenJDK\uff0c\u4f46\u5176\u76ee\u6807\u662f\u4f7f\u7528\u6237\u5728\u4f7f\u7528\u5b8c\u5168\u81ea\u7531\u5f00\u6e90\u7684\u5de5\u5177\u65f6\u66f4\u5bb9\u6613\u5efa\u7acb\u548c\u5e03\u7f72OpenJDK\u3002<\/p>\n

\uff08LCTT\u8bc4\u6ce8\uff1a\u963f\u91cc\u5df4\u5df4\u4e5f\u6709\u4e00\u4e2a\u5b83\u81ea\u5df1\u7ef4\u62a4\u7684OpenJDK\u53d1\u884c\u7248\u201c\u9f99\u4e95Dragonwell\u201d\u3002\u4ee5\u4e0b\u5f15\u81ea\u5176\u5b98\u7f51\uff1a\u201cAlibabaDragonwell\u662f\u4e00\u6b3e\u514d\u8d39\u7684\uff0c\u751f\u4ea7\u5c31\u7eea\u578bOpenJDK\u53d1\u884c\u7248\uff0c\u63d0\u4f9b\u5e38\u5e74\u652f\u6301\uff0c\u5305\u62ec\u6027\u80fd\u63d0\u9ad8\u548c\u5b89\u5168\u4fee\u8865\u3002\u2026\u2026AlibabaDragonwell\u4f5c\u4e3aJava\u5e94\u7528\u7684\u57fa\u77f3\uff0c\u652f\u6491\u4e86\u963f\u91cc\u7ecf\u6d4e\u4f53\u5185\u6240\u6709\u7684Java\u4e1a\u52a1\u3002AlibabaDragonwell\u5b8c\u5168\u517c\u5bb9JavaSE\u6807\u51c6\uff0c\u2026\u2026\u201d\uff09<\/p>\n

\u6211\u5e94\u5f53\u5b89\u88c5\u90a3\u4e2aJava\uff1f<\/p>\n

\u5047\u5982\u4f60\u5bf9\u90a3\u4e9b\u9009\u62e9\u500d\u611f\u4e0d\u77e5\u6240\u63aa\uff0c\u8fd9\u4e48\u7b80\u5355\u7684\u7b54\u6848\u5c31\u662f\u4f60\u5e94\u5f53\u5b89\u88c5\u7684Java\u5b9e\u73b0\u5e94\u5f53\u662f\u6700\u5bb9\u6613\u5b89\u88c5\u7684\u90a3\u79cd\u3002\u5f53\u5e94\u7528\u7a0b\u5e8f\u544a\u8bc9\u4f60\u987b\u8981Java12\uff0c\u4f46\u4f60\u7684\u50a8\u5b58\u5e93\u4e2d\u53ea\u6709Java8\u65f6\uff0c\u53ef\u4ee5\u5b89\u88c5\u53ef\u4ee5\u4ece\u53ef\u9760\u6765\u6e90\u4e2d\u627e\u5230\u7684Java12\u7684\u4efb\u4f55\u5b9e\u73b0\u3002\u5728Linux<\/a>\u4e0a\uff0c\u4f60\u53ef\u4ee5\u4e00\u6b21\u5b89\u88c5\u51e0\u4e2a\u4e0d\u540c\u7248\u672c\u7684Java\uff0c\u5b83\u4eec\u4e0d\u4f1a\u76f8\u4e92\u5e72\u6270\u3002<\/p>\n

\u5047\u5982\u4f60\u662f\u987b\u8981\u9009\u62e9\u4f7f\u7528\u90a3\u4e2a\u7248\u672c\u7684\u5f00\u53d1\u4eba\u5458\uff0c\u5219\u5e94\u8003\u8651\u6240\u9700\u7684\u7ec4\u4ef6\u3002\u5047\u5982\u9009\u62e9Oracle\u7684\u7248\u672c\uff0c\u8bf7\u6ce8\u610f\uff0c\u8f6f\u4ef6\u5305\u4e2d\u5305\u542b\u4e13\u6709\u7684\u63d2\u4ef6\u548c\u5b57\u4f53\uff0c\u53ef\u80fd\u4f1a\u5f71\u54cd\u4f60\u5206\u53d1\u4f60\u7684\u5e94\u7528\u7a0b\u5e8f\u3002\u5728IcedTea\u6216OpenJDK\u4e0a\u8fdb\u884c\u5f00\u53d1\u662f\u6700\u5b89\u5168\u7684\u3002<\/p>\n

\u4ece\u50a8\u5b58\u5e93\u5b89\u88c5OpenJDK\uff1f<\/p>\n

\u5982\u4eca\uff0c\u4f60\u5df2\u7136\u6653\u5f97\u8981\u9009\u62e9\u54ea\u4e9b\u4e86\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u8f6f\u4ef6\u5305\u7ba1\u7406\u5668\u641c\u7d22OpenJDK\u6216IcedTea\uff0c\u4e4b\u540e\u5b89\u88c5\u6240\u9700\u7684\u7248\u672c\u3002\u6709\u4e9b\u53d1\u884c\u7248\u4f7f\u7528\u5173\u952e\u5b57latest\u6765\u6307\u793a\u6700\u65b0\u7248\u672c\uff0c\u8fd9\u4e00\u822c\u662f\u4f60\u8981\u8fd0\u884c\u7684\u5e94\u7528\u7a0b\u5e8f\u6240\u987b\u8981\u7684\u3002\u6309\u7167\u4f60\u4f7f\u7528\u7684\u8f6f\u4ef6\u5305\u7ba1\u7406\u5668\uff0c\u4f60\u751a\u81f3\u53ef\u4ee5\u8003\u8651\u4f7f\u7528grep\u8fc7\u6ee4\u641c\u7d22\u7ed3\u679c\u4ee5\u4ec5\u5305\u62ec\u6700\u65b0\u7248\u672c\u3002\u6bd4\u5982\uff0c\u5728Fedora\u4e0a\uff1a<\/p>\n

\n

$ sudo dnf search openjdk | grep latest | cut -f1 -d':'\njava-latest-openjdk-demo.x86_64\njava-openjdk.i686\njava-openjdk.x86_64\njava-latest-openjdk-jmods.x86_64\njava-latest-openjdk-src.x86_64\njava-latest-openjdk.x86_64\n[...]<\/code><\/pre>\n<\/p>\n

\u53ea\u6709\u5f53\u4f60\u5c1d\u8bd5\u8fd0\u884c\u7684\u5e94\u7528\u7a0b\u5e8f\u575a\u6301\u8981\u6c42\u4f60\u4f7f\u7528Java\u7684\u65e7\u7248\u672c\u65f6\uff0c\u4f60\u624d\u5e94\u5f53\u77a7\u77a7latest\u4e4b\u524d\u7684\u7248\u672c\u3002<\/p>\n

\u5728Fedora\u6216\u7c7b\u4f3c\u7cfb\u7edf\u4e0a\u5b89\u88c5Java\uff1a<\/p>\n

\n

$ sudo dnf install java-latest-openjdk<\/code><\/pre>\n<\/p>\n

\u5047\u5982\u4f60\u7684\u53d1\u884c\u7248\u4e0d\u4f7f\u7528latest\u6807\u7b7e\uff0c\u5219\u53ef\u4ee5\u4f7f\u7528\u5176\u4ed6\u5173\u952e\u5b57\uff0c\u6bd4\u5982default\u3002\u4ee5\u4e0b\u662f\u5728Debian\u4e0a\u641c\u7d22OpenJDK\u7684\u4fe1\u606f\uff1a<\/p>\n

\n

$ sudo apt search openjdk | less\ndefault-jdk\n\u00a0 Standard Java development kit\ndefault-jre\n\u00a0 Standard Java runtime\nopenjdk-11-jdk\n\u00a0 OpenJDK development kit (JDK)\n[...]<\/code><\/pre>\n<\/p>\n

\u5728\u8fd9\u4e9b\u60c5\u51b5\u4e0b\uff0cdefault-jre\u8f6f\u4ef6\u5305\u9002\u5b9c\u7528\u6237\uff0c\u800cdefault-jdk\u5219\u9002\u5b9c\u5f00\u53d1\u4eba\u5458\u3002<\/p>\n

\u6bd4\u5982\uff0c\u8981\u5728Debian\u4e0a\u5b89\u88c5JRE\uff1a<\/p>\n

\n

$ sudo apt install default-jre<\/code><\/pre>\n<\/p>\n

\u5982\u4eca\u5df2\u5b89\u88c5\u597dJava\u3002<\/p>\n

\u4f60\u7684\u50a8\u5b58\u5e93\u4e2d\u53ef\u80fd\u6709\u8bb8\u591a\u4e0eJava\u76f8\u5173\u7684\u8f6f\u4ef6\u5305\u3002\u8981\u641c\u7d22OpenJDK\uff0c\u5047\u5982\u4f60\u662f\u7528\u6237\uff0c\u5219\u67e5\u627e\u6700\u65b0\u7684JRE\u6216JVM\uff0c\u5047\u5982\u4f60\u662f\u5f00\u53d1\u4eba\u5458\uff0c\u5219\u67e5\u627e\u6700\u65b0\u7684JDK\u3002<\/p>\n

\u4ece\u4e92\u8054\u7f51\u4e0a\u5b89\u88c5Java<\/p>\n

\u5047\u5982\u5728\u50a8\u5b58\u5e93\u4e2d\u627e\u4e0d\u5230JRE\u6216JDKlinux\u89c6\u9891\uff0c\u6216\u5219\u627e\u4e0d\u5230\u6ee1\u8db3\u4f60\u9700\u6c42\u7684JRE\u6216JDK\uff0c\u5219\u53ef\u4ee5\u4ece\u4e92\u8054\u7f51\u4e0a\u4e0b\u8f7d\u5f00\u6e90\u7684Java\u8f6f\u4ef6\u5305\u3002\u4f60\u53ef\u4ee5\u5728\u4e2d\u627e\u5230\u987b\u8981\u81ea\u52a8\u5b89\u88c5\u7684tar\u65b9\u5f0f\u7684OpenJDK\u4e0b\u8f7d\u6587\u4ef6\uff0c\u6216\u5219\u53ef\u4ee5\u4eceAzul\u4e0b\u8f7dtar\u65b9\u5f0f\u7684Zulu\u793e\u533a\u7248\u6216\u5176\u53ef\u5b89\u88c5\u7684RPM\u6216DEB\u8f6f\u4ef6\u5305\u3002<\/p>\n

\u4eceTAR\u6587\u4ef6\u5b89\u88c5Java<\/p>\n

\u5047\u5982\u4ece\u6216Azul\u4e0b\u8f7dTAR\u6587\u4ef6\uff0c\u5219\u5fc5\u987b\u81ea\u52a8\u5b89\u88c5\u3002\u8fd9\u4e00\u822c\u79f0\u4e3a\u201c\u672c\u5730\u201d\u5b89\u88c5\uff0c\u7531\u4e8e\u4f60\u6ca1\u6709\u5c06Java\u5b89\u88c5\u5230\u201c\u5168\u5c40\u201d\u4f4d\u7f6e\u3002\u4f60\u53ef\u4ee5\u5728PATH\u4e2d\u9009\u62e9\u4e00\u4e2a\u5408\u9002\u7684\u4f4d\u7f6e\u3002<\/p>\n

\u5047\u5982\u4f60\u4e0d\u6653\u5f97PATH\u4e2d\u5305\u542b\u54ea\u4e9b\uff0c\u8bf7\u67e5\u770b\u4e00\u4e0b\u4ee5\u627e\u51fa\uff1a<\/p>\n

\n

$ echo $PATH\n\/usr\/local\/bin:\/usr\/local\/sbin:\/usr\/bin:\/usr\/sbin:\/home\/seth\/bin<\/code><\/pre>\n<\/p>\n

\u5728\u6b64\u793a\u4f8bPATH\u4e2d\uff0c\u4f4d\u7f6e\/usr\/local\/bin\u548c\/home\/seth\/bin\u662f\u4e0d\u9519\u7684\u9009\u62e9\u3002\u5047\u5982\u4f60\u662f\u8ba1\u7b97\u673a\u4e0a\u7684\u60df\u4e00\u7528\u6237\uff0c\u8fd9\u4e48\u4f60\u81ea\u5df1\u7684\u5bb6\u76ee\u5f55\u5c31\u5f88\u6709\u610f\u4e49\u3002\u5047\u5982\u4f60\u7684\u8ba1\u7b97\u673a\u4e0a\u6709\u597d\u591a\u7528\u6237\uff0c\u5219\u6700\u597d\u9009\u62e9\u4e00\u4e2a\u901a\u7528\u4f4d\u7f6e\uff0c\u6bd4\u5982\/usr\/local\u6216\/opt\u3002<\/p>\n

\u5047\u5982\u4f60\u65e0\u6743\u8bbf\u95ee\u987b\u8981sudo\u6743\u9650\u7684\/usr\/local\u4e4b\u7c7b\u7684\u7cfb\u7edf\u7ea7\u76ee\u5f55\uff0c\u5219\u53ef\u4ee5\u5728\u4f60\u81ea\u5df1\u7684\u5bb6\u76ee\u5f55\u4e2d\u521b\u5efa\u4e00\u4e2a\u672c\u5730bin\uff08\u610f\u601d\u662f\u201c\u4e8c\u8865\u7801binary\u201d\uff0c\u800c\u4e0d\u662f\u201c\u5783\u573e\u7bb1wastebin\u201d\uff09\u6216Applications\u6587\u4ef6\u5939\uff1a<\/p>\n

\n

$ mkdir ~\/bin<\/code><\/pre>\n<\/p>\n

\u5047\u5982\u5b83\u4e0d\u5728\u4f60\u7684PATH\u4e2d\uff0c\u8bf7\u5c06\u5176\u6dfb\u52a0\u5230\u5176\u4e2d\uff1a<\/p>\n

\n

$ echo PATH=$PATH:$HOME\/bin >> ~\/.bashrc\n$ source ~\/.bashrc<\/code><\/pre>\n<\/p>\n

\u6700\u540e\uff0c\u5c06\u538b\u7f29\u5305\u89e3\u538b\u7f29\u5230\u4f60\u9009\u62e9\u7684\u76ee\u5f55\u4e2d\u3002<\/p>\n

\n

$ tar --extract --file openjdk*linux-x64_bin.tar.gz --directory=$HOME\/bin<\/code><\/pre>\n<\/p>\n

Java\u5982\u4eca\u5b89\u88c5\u597d\u4e86\u3002<\/p>\n

\u4eceRPM\u6216DEB\u5b89\u88c5Java<\/p>\n

\u5018\u82e5\u4ece\u4e0b\u8f7dRPM\u6216DEB\u6587\u4ef6\uff0c\u5219\u53ef\u4ee5\u4f7f\u7528\u8f6f\u4ef6\u5305\u7ba1\u7406\u5668\u8fdb\u884c\u5b89\u88c5\u3002<\/p>\n

\u5bf9\u4e8eFedora\u3001CentOS\u3001RHEL\u7b49\uff0c\u8bf7\u4e0b\u8f7dRPM\u5e76\u4f7f\u7528DNF\u8fdb\u884c\u5b89\u88c5\uff1a<\/p>\n

\n

$ sudo dnf install zulu*linux.x86_64.rpm<\/code><\/pre>\n<\/p>\n

\u5bf9\u4e8eDebian\u3001Ubuntu\u3001Pop_OS\u548c\u7c7b\u4f3c\u53d1\u884c\u7248\uff0c\u8bf7\u4e0b\u8f7dDEB\u8f6f\u4ef6\u5305\u5e76\u4f7f\u7528Apt\u5b89\u88c5\u5b83\uff1a<\/p>\n

\n

$ sudo dpkg -i zulu*linux_amd64.deb<\/code><\/pre>\n<\/p>\n

Java\u5982\u4eca\u5b89\u88c5\u597d\u4e86\u3002<\/p>\n

\u7528alternatives\u5b89\u88c5\u4f60\u7684Java\u7248\u672c<\/p>\n

\u4e00\u4e9b\u5e94\u7528\u7a0b\u5e8f\u662f\u4e3a\u7279\u5b9a\u7248\u672c\u7684Java\u5f00\u53d1\u7684\uff0c\u4e0d\u80fd\u4e0e\u5176\u4ed6\u4efb\u4f55\u7248\u672c\u4e00\u8d77\u4f7f\u7528\u3002\u6b64\u7c7b\u60c5\u51b5\u6781\u5c11\u89c1linux \u8f93\u5165\u6cd5\uff0c\u4f46\u786e\u5b9e\u4f1a\u53d1\u751f\uff0c\u5728Linux\u4e0a\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u672c\u5730\u5b89\u88c5\u65b9\u5f0f\uff08\u8bf7\u53c2\u9605\u524d\u9762\u201c\u4eceTAR\u6587\u4ef6\u5b89\u88c5Java\u201d\u4e00\u8282\uff09\u6216\u4f7f\u7528alternatives\u5e94\u7528\u7a0b\u5e8f\u6765\u89e3\u51b3\u6b64\u51b2\u7a81\u3002<\/p>\n

alternatives\u547d\u4ee4<\/a>\u4f1a\u67e5\u627eLinux\u7cfb\u7edf\u4e0a\u5b89\u88c5\u7684\u5e94\u7528\u7a0b\u5e8flinux\u8f6f\u4ef6\u5982\u4f55\u5b89\u88c5<\/strong>\uff0c\u5e76\u8ba9\u4f60\u9009\u62e9\u8981\u4f7f\u7528\u7684\u7248\u672c\u3002\u6709\u4e9b\u53d1\u884c\u7248\uff0c\u6bd4\u5982Slackware\uff0c\u4e0d\u63d0\u4f9balternatives\u547d\u4ee4\uff0c\u56e0\u800c\u4f60\u5fc5\u987b\u4f7f\u7528\u672c\u5730\u5b89\u88c5\u65b9\u5f0f\u3002\u5728Fedora\u3001CentOS\u548c\u7c7b\u4f3c\u7684\u53d1\u884c\u7248\u4e0a\uff0c\u8be5\u547d\u4ee4\u662falternatives\u3002\u5728Debian\u3001Ubuntu\u548c\u7c7b\u4f3c\u7684\u7cfb\u7edf\u4e0a\uff0c\u8be5\u547d\u4ee4\u662fupdate-alternatives\u3002<\/p>\n

\u8981\u83b7\u53d6\u5f53\u524d\u5df2\u5b89\u88c5\u5728Fedora\u7cfb\u7edf\u4e0a\u7684\u5e94\u7528\u7a0b\u5e8f\u7684\u53ef\u7528\u7248\u672c\u5217\u8868\uff1a<\/p>\n

\n

$ alternatives --list<\/code><\/pre>\n<\/p>\n

\u5728Debian\u4e0a\uff0c\u4f60\u5fc5\u987b\u6307\u5b9a\u53ef\u4f9b\u53d6\u4ee3\u7684\u5e94\u7528\u7a0b\u5e8f\uff1a<\/p>\n

\n

$ update-alternatives --list java<\/code><\/pre>\n<\/p>\n

\u5728Fedora\u4e0a\u9009\u62e9\u8981\u4f7f\u7cfb\u7edf\u5c06\u90a3\u4e2a\u7248\u672c\u4f5c\u4e3a\u9ed8\u8ba4\u7248\u672c\uff1a<\/p>\n

\n

$ sudo alternatives --config java<\/code><\/pre>\n<\/p>\n

\u5728Debian\u4e0a\uff1a<\/p>\n

\n

$ sudo updates-alternatives --config java<\/code><\/pre>\n<\/p>\n

\u4f60\u53ef\u4ee5\u6309\u7167\u987b\u8981\u8fd0\u884c\u7684\u5e94\u7528\u7a0b\u5e8f\uff0c\u6309\u7167\u987b\u8981\u4fee\u6539\u9ed8\u8ba4\u7684Java\u7248\u672c\u3002<\/p>\n

\u8fd0\u884cJava\u5e94\u7528<\/p>\n

Java\u5e94\u7528\u7a0b\u5e8f\u4e00\u822c\u4ee5JAR\u6587\u4ef6\u7684\u65b9\u5f0f\u5206\u53d1\u3002\u6309\u7167\u4f60\u5b89\u88c5Java\u7684\u65b9\u6cd5\uff0c\u4f60\u7684\u7cfb\u7edf\u53ef\u80fd\u65e9\u5df2\u4e3a\u8fd0\u884cJava\u5e94\u7528\u7a0b\u5e8f\u914d\u7f6e\u597d\u4e86\uff0c\u8fd9\u4f7f\u4f60\u53ea\u9700\u53cc\u51fb\u5e94\u7528\u7a0b\u5e8f\u56fe\u6807\uff08\u6216\u4ece\u5e94\u7528\u7a0b\u5e8f\u83dc\u5355\u4e2d\u9009\u62e9\u5b83\uff09\u5373\u53ef\u8fd0\u884c\u3002\u5047\u5982\u5fc5\u987b\u6267\u884c\u672a\u4e0e\u7cfb\u7edf\u5176\u4f59\u90e8\u4efd\u96c6\u6210\u7684\u672c\u5730Java\u5b89\u88c5\uff0c\u5219\u53ef\u4ee5\u76f4\u63a5\u4ece\u7ec8\u7aef\u542f\u52a8Java\u5e94\u7528\u7a0b\u5e8f\uff1a<\/p>\n

\n

$ java -jar ~\/bin\/example.jar &<\/code><\/pre>\n<\/p>\n

Java\u662f\u4e2a\u597d\u4e1c\u897f<\/p>\n

Java\u662f\u5c11\u6570\u5c06\u8de8\u5e73\u53f0\u5f00\u53d1\u7f6e\u4e8e\u9996\u4f4d\u7684\u7f16\u7a0b\u73af\u5883\u4e4b\u4e00\u3002\u6ca1\u6709\u54ea\u4e9b\u6bd4\u95ee\u4e00\u4e2a\u5e94\u7528\u7a0b\u5e8f\u662f\u5426\u80fd\u5728\u4f60\u7684\u5e73\u53f0\u4e0a\u8fd0\u884c\u4e4b\u540e\u53d1\u89c9\u8be5\u5e94\u7528\u7a0b\u5e8f\u662f\u7528Java\u7f16\u64b0\u8981\u8ba9\u4eba\u500d\u611f\u677e\u4e00\u53e3\u6c14\u7684\u4e86\u3002\u5b83\u662f\u8fd9\u4e48\u7b80\u5355\uff0c\u65e0\u8bba\u4f60\u662f\u5f00\u53d1\u4eba\u5458\u8fd8\u662f\u7528\u6237\uff0c\u4f60\u90fd\u53ef\u4ee5\u7529\u6389\u4efb\u4f55\u5e73\u53f0\u4e0a\u7684\u6050\u60e7\u3002\u5728\u684c\u9762\u4e0a\u62e5\u62b1Java\u5e94\u7528\u7a0b\u5e8f\uff0c\u4e4b\u540e\u5728\u6240\u6709\u684c\u9762\u4e0a\u8fd0\u884c\u5b83\u4eec\u5427\u3002<\/p>\n

via:<\/p>\n

\u4f5c\u8005\uff1aSethKenlon\u9009\u9898\uff1alujun9972\u8bd1\u8005\uff1awxy\u6821\u5bf9\uff1awxy<\/p>\n

\u672c\u6587\u7531LCTT\u539f\u521b\u7f16\u8bd1\uff0cLinux\u4e2d\u56fd\u8363\u8a89\u63a8\u51fa<\/p>\n","protected":false},"excerpt":{"rendered":"

\u5e94\u7528\u7a0b\u5e8f\uff0c\u7136\u540e\u5728\u6240\u6709\u684c\u9762\u4e0a\u8fd0\u884c\u5b83\u4eec\u3002\u8fd9\u6837\u7684\u8f6f\u4ef6\u5305\u7ba1\u7406\u5668\u8fdb\u884c\u5b89\u88c5\uff0c\u800c\u6709\u65f6\u4f60\u53ef\u80fd\u4f1a\u4ece\u7f51\u7ad9\u4e0a\u4e0b\u8f7d\u53ef\u6267\u884c\u6587\u4ef6\u6216\u5b89\u88c5\u7a0b\u5e8f\u3002\u7684\u7248\u672c\uff0c\u8bf7\u6ce8\u610f\uff0c\u8f6f\u4ef6\u5305\u4e2d\u5305\u542b\u4e13\u6709\u7684\u63d2\u4ef6\u548c\u5b57\u4f53\uff0c\u53ef\u80fd\u4f1a\u5f71\u54cd\u4f60\u5206\u53d1\u4f60\u7684\u5e94\u7528\u7a0b\u5e8f\u3002\u6587\u4ef6\uff0c\u5219\u5fc5\u987b\u624b\u52a8\u5b89\u88c5\u3002\u6587\u4ef6\uff0c\u5219\u53ef\u4ee5\u4f7f\u7528\u8f6f\u4ef6\u5305\u7ba1\u7406\u5668\u8fdb\u884c\u5b89\u88c5\u3002\u7cfb\u7edf\u4e0a\u5b89\u88c5\u7684\u5e94\u7528\u7a0b\u5e8f\uff0c\u5e76\u8ba9\u4f60\u9009\u62e9\u8981\u4f7f\u7528\u7684\u7248\u672c\u3002\u7cfb\u7edf\u4e0a\u7684\u5e94\u7528\u7a0b\u5e8f\u7684\u53ef\u7528\u7248\u672c\u5217\u8868\uff1a\u5e94\u7528\u7a0b\u5e8f\uff0c\u7136\u540e\u5728\u6240\u6709\u684c\u9762\u4e0a\u8fd0\u884c\u5b83\u4eec\u5427\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-267792","post","type-post","status-publish","format-standard","hentry","category-tougao","tag-999"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/267792","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=267792"}],"version-history":[{"count":0,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/267792\/revisions"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=267792"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=267792"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=267792"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}