How to Install JDK on OpenSUSE Leap 42.1 x86_64.
This tutorial will cover the installation of 64-bit JDK 8u112 on OpenSUSE
- Update OS
zypper update
- Checking
the current java version and remove OpenJDK (if you want)
java
-version
zypper remove *OpenJDK*
- Checking the java version again(if you want to confirm whether OpenJDK
is removed)
- Make
a directory “java” in /usr/local/
cd /usr/local/
mkdir java
- Move
to “java” directory and Download “jdk-8u112-linux-x64.tar.gz”
file
into the /usr/local/java directory as shown below.
cd
java
wget
--no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F;
oraclelicense=accept-securebackup- cookie"
"http://download.oracle.com/otn- pub/java/jdk/8u112-b15/jdk-8u112-linux- x64.tar.gz"
- Once
file has been downloaded, you may extract the tarball using the tar command and delete tar file as shown below.
tar
-zxvf jdk-8u112-linux-x64.tar.gz
rm
-rf jdk-8u112-linux-x64.tar.gz
- Create
“latest” directory and create link as shown below
ln
-s jdk1.8.0_112 latest
- Edit
“bashrc” file and insert the code as shown below
vim
~/.bashrc
export JAVA_HOME=/usr/local/java/latest
export PATH=$JAVA_HOME/bin:$PATH
- Reload
the “.bashrc file .
source
~/.bashrc
- Edit
“bash_profile” file and insert the code as shown below
vi
~.bash_profile
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
- Checking
the java version and javac working.
zypper update
java -version
zypper remove *OpenJDK*
is removed)
cd /usr/local/
mkdir java
into the /usr/local/java directory as shown below.
cd java
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F;
oraclelicense=accept-securebackup- cookie" "http://download.oracle.com/otn- pub/java/jdk/8u112-b15/jdk-8u112-linux- x64.tar.gz"
tar -zxvf jdk-8u112-linux-x64.tar.gz
rm -rf jdk-8u112-linux-x64.tar.gz
ln -s jdk1.8.0_112 latest
vim ~/.bashrc
export JAVA_HOME=/usr/local/java/latest
source ~/.bashrc
vi ~.bash_profile
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
fi







No comments:
Post a Comment