惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Visual Studio Blog
Recent Announcements
Recent Announcements
雷峰网
雷峰网
The GitHub Blog
The GitHub Blog
罗磊的独立博客
月光博客
月光博客
J
Java Code Geeks
A
About on SuperTechFans
Microsoft Security Blog
Microsoft Security Blog
D
Docker
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
F
Fortinet All Blogs
U
Unit 42
C
Check Point Blog
Martin Fowler
Martin Fowler
有赞技术团队
有赞技术团队
博客园 - 叶小钗
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
酷 壳 – CoolShell
酷 壳 – CoolShell
Blog — PlanetScale
Blog — PlanetScale
大猫的无限游戏
大猫的无限游戏
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
阮一峰的网络日志
阮一峰的网络日志
MyScale Blog
MyScale Blog

秋水逸冰

丽萨主机:双ISP家宽住宅IP VPS/CN2 GIA精品网/G口大带宽 | 秋水逸冰 Linux Kernel 6.18.x 编译版 | 秋水逸冰 思考未来人与 AI 的关系 | 秋水逸冰 3X-UI 面板安装和使用教程 | 秋水逸冰 Xray-UI 面板安装和使用教程 | 秋水逸冰 WCMP (Windows + Caddy + MariaDB + PHP) Nginx for Windows | 秋水逸冰 Aria2 for Windows | 秋水逸冰 Curl for Windows | 秋水逸冰 Wget for Windows | 秋水逸冰 Windows 11 Enterprise LTSC DD 镜像 Windows Server 2025 Datacenter DD 镜像 重新编译 curl 以支持 HTTP3 | 秋水逸冰 tiny10 和 tiny11 23H2 的 Windows DD 镜像 从 Apache httpd 切换到 Caddy2 LCMP (Linux + Caddy + MariaDB + PHP) Windows 11 Pro for Workstations 22H2 DD 镜像 Shadowsocks 编译版 by Teddysun | 秋水逸冰 适用于 UEFI 启动的多个 Windows 系统 DD 镜像 Linux Kernel 5.15.x 编译版 | 秋水逸冰 制作适用于 WSL 的任意 Linux 镜像 Windows 11 Pro for Workstations 21H2 DD 镜像 Windows 10 Enterprise LTSC DD 镜像 Linux Kernel 5.14.x 编译版 | 秋水逸冰 Linux Kernel 5.13.x 编译版 | 秋水逸冰 Windows Server 2022 Datacenter DD 镜像 在 Windows 10 上安装 Rocky Linux 系统 Linux Kernel 5.12.x 编译版 | 秋水逸冰 Linux Kernel 5.11.x 编译版 | 秋水逸冰 在 Windows 10 上安装 CentOS 系统
CentOS下用wget命令下载JDK | 秋水逸冰
秋水逸冰 · 2013-03-30 · via 秋水逸冰

技术 秋水逸冰 28435浏览 2评论

通常需要下载jdk时,直接用wget命令是不行的。那么,如何解决呢?
只需要在wget的时候加上一个特殊的cookie就可以搞定,下载最新版jdk-8u102的完整命令:

wget --no-cookie --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u102-b14/jdk-8u102-linux-x64.rpm -O jdk-8u102-linux-x64.rpm

而如果出现Unable to establish SSL connection的话,在wget后面加上–no-check-certificate即可,命令如下:

wget --no-cookie --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u102-b14/jdk-8u102-linux-x64.rpm -O jdk-8u102-linux-x64.rpm

安装jdk

rpm -ivh jdk-8u102-linux-x64.rpm

配置jdk,请参照《CentOS下JDK7和tomcat的安装配置》一文。

以上的方法不仅仅是在CentOS下,其他的Linux发行版也可以。

有的时候,原来的系统里已经安装了旧版本的jdk,如何卸载呢?
先查看系统已安装的jdk

rpm -qa | grep jdk

返回jdk1.8.0_102-1.8.0_102-fcs.x86_64(这里是举例说明)

卸载已安装的jdk

rpm -e --nodeps jdk1.8.0_102-1.8.0_102-fcs.x86_64

之后再输入java -version则会提示command not found。至此,卸载完成。开始安装新版本的jdk吧。

转载请注明:秋水逸冰 » CentOS下用wget命令下载JDK