在linux mint 上安装 Oracle JDK 的方法
-
Open up the Terminal (Alt + F2 > Terminal).
-
Remove OpenJDK installation.
sudo apt-get update && apt-get remove openjdk*
-
Download Oracle JDK from here. You are looking for a linux version with tar.gz extension. Also choose the right version from 32-bit (x86) and 64bit (x64) one.
-
Change directory into one with downloaded tarball. In my case $HOME/Downloads.
cd ~/Downloads
-
Extract tarball. Replace with a name of dowloaded file. (just press Tab and it will be autocompleted.)
tar -zxvf jdk-
-
As a root create a folder in /opt where jdk will be stored.
sudo mkdir -p /opt/java
-
Move extracted folder to /opt/java. In my case, version number was 1.7.0_25.
sudo mv jdk1.7.0_25 /opt/java
-
Make JDK system default.
sudo update-alternatives --install "/usr/bin/java" "java" "/opt/java/jdk1.7.0_25/bin/java" 1
sudo update-alternatives --set java /opt/java/jdk1.7.0_25/bin/java
-
Test installed java version.
java version "1.7.0_25" Java(TM) SE Runtime Environment (build 1.7.0_25-b15) Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)
$ java -version