Jdk (Java Development Kit)

From campisano.org
Jump to navigation Jump to search

JDK

Install

# shared/opt install schema v1.3.1
su -
#### as root ####
# dependencies
apt-get -qq -y install wget coreutils findutils
apt-get -qq -y install tar gzip
# binary
SOFTWARE_PATH="/home/shared/opt/software"
NAME="jdk"
# example for java 14
VERSION="14.0.2"
URL="https://download.java.net/java/GA/jdk${VERSION}/205943a0976c4ed48cb16f1043c5c647/12/GPL/openjdk-${VERSION}_linux-x64_bin.tar.gz"
# OR #
# example for java 11
VERSION="11.0.2"
URL="https://download.java.net/java/GA/jdk11/9/GPL/openjdk-${VERSION}_linux-x64_bin.tar.gz"
umask 0027
mkdir -p "${SOFTWARE_PATH}/tmp/${NAME}_${VERSION}"
cd "${SOFTWARE_PATH}/tmp"
wget -c --no-check-certificate "${URL}"
tar -xzf "openjdk-${VERSION}_linux-x64_bin.tar.gz" && mv "jdk-${VERSION}/"* "${NAME}_${VERSION}" && rmdir "jdk-${VERSION}/"
cd "${SOFTWARE_PATH}"
chown -R root:users "tmp"
find "tmp" -type d -exec chmod a-s,u+rwx,g+rx,g-w,o-rwx {} \;
find "tmp" -type f -exec chmod a-s,u+rw,g+r,g-w,o-rwx {} \;
mv "tmp/${NAME}_${VERSION}" "${NAME}_${VERSION}"
rm -rf tmp
ln -s -f -T "${NAME}_${VERSION}" "${NAME}"
exit
  • and setup your user environment (you can put the follow in ~/.profile)
export SOFTWARE_PATH="/home/shared/opt/software"
export JAVA_HOME="${SOFTWARE_PATH}/jdk"
export PATH="${JAVA_HOME}/bin:${PATH}";