Setup Linux Java Environment

Setup linux java environment

wget java file (can not use wget directly, need some vars)

1
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u111-b14/jdk-8u111-linux-x64.tar.gz

unzip java file

1
tar -xvzf jdk-8u111-linux-x64.tar.gz
  • f: this must be the last flag of the command, and the tar file must be immediately after. It tells tar the name and path of the compressed file.
  • z: tells tar to decompress the archive using gzip
  • x: tar can collect files or extract them. x does the latter.
  • v: makes tar talk a lot. Verbose output shows you all the files being extracted.

setup java environment variables -> .bashrc

1
2
3
4
5
JAVA_HOME=/path/to/jdk_home
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
export JAVA_HOME
export JRE_HOME
export PATH