The materials created on 2017/06/03 will be uploaded.
An easy way to install Java on Linux (CentOS7) is to use the yum command or rpm command, but here we will show you how to install it manually.
$ su -
#
# curl -OL --header "Cookie: oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz"
(The URL of the link destination may have changed?) (You may download it from your browser instead of using the command.)
# tar xvzf ./jdk-8u131-linux-x64.tar.gz
("Jdk1.8.0_131" is created.)
# mv ./jdk1.8.0_131 /opt
# ln -s /opt/jdk1.8.0_131 /opt/java
# exit
$
shell:.java.env
export JAVA_HOME=/opt/java
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.
$ source .java.env
$ java –version
(The following is displayed.)
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
.bash_profile
・ ・ ・ ・ ・ ・ ・ ・
source .java.env ← Add this line
This time, ".java.env" was created and the environment was set with the source command, but if the following files are placed under the "/etc/profile.d" directory, the environment variables will be set at login.
shell:./etc/profile.d/java.sh
#!/bin/sh
export JAVA_HOME=/opt/java
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.
that's all
Recommended Posts