This method is also applicable to various Linux versions, including but not limited to Ubuntu 18.10.
To download jdk from Oracle official website, you need to click the accept licence to download it. Use the following command to download it directly.
Please go to Official Website to obtain the installation package link.
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie"Installation package link
Such as:
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u181-b13/96a7b8442fe848ef90c96a2fad6ed6d1/jdk-8u181-linux-x64.tar.gz
tar -xzvf jdk-8u181-linux-x64.tar.gz
vi /etc/profile
Add at the end
# set java environment
JAVA_HOME=/home/wind/jdk1.8.0_181
JRE_HOME=/home/wind/jdk1.8.0_181/jre
CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
export JAVA_HOME JRE_HOME CLASS_PATH PATH
source /etc/profile
Recommended Posts