Ubuntu 12.04 install JDK1.8.0_25
阿新 • • 發佈:2019-02-04
1、download JDK 8
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
$ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.8.0_25/bin/javac 300
$ sudo update-alternatives --config java
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
2、tarball
$ sudo mkdir /usr/lib/jvm
$ sudo mv jdk-8u25-linux-x64.tar.gz /usr/lib/jvm/
$ cd /usr/lib/jvm/
$ sudo tar -zxvf jdk-8u25-linux-x64.tar.gz
$ sudo rm jdk-8u25-linux-x64.tar.gz
3、configure
$ sudo gedit /etc/environment
add environment variables:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/jvm/jdk1.8.0_25/bin"
CLASSPATH="/usr/lib/jvm/jdk1.8.0_25/lib"
JAVA_HOME="/usr/lib/jvm/jdk1.8.0_25"
the next steps tell to the ubuntu system
$ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.8.0_25/bin/javac 300
$ sudo update-alternatives --config java
4. Test: java -version
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)