1. check you java version
$ java -version
If Oracle Java is used, the results should look like:
java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
Otherwise OpenJDK java will like:
java version "1.7.0_21"
OpenJDK Runtime Environment (IcedTea 2.3.9) (7u21-2.3.9-1ubuntu1)
OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)
若不是請到 Oracle Java SE 此網站
Downloads java .tar.gz 檔。
Note: If installing the Oracle JRE in a cloud environment, accept the license agreement,
download the installer to your local client, and then use scp (secure copy) to transfer the file to
your cloud machines.
Make a directory for the JRE:
2. create jvm folder
$ sudo mkdir -p /usr/lib/jvm
Unpack the tarball and install the JRE:
3. $ sudo tar zxvf jre-7u65-linux-x64.tar.gz -C /usr/lib/jvm
The JRE files are installed into a directory called /usr/lib/jvm/jre-7u_version.
Tell the system that there's a new Java version available:
4. $ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jre1.7.0_65/bin/java" 1
If updating from a previous version that was removed manually, execute the above command twice, because you'll get an error message the first time.
Set the new JRE as the default:
5. $ sudo update-alternatives --set java /usr/lib/jvm/jre1.7.0_65/bin/java
Make sure your system is now using the correct JRE. For example:
6. $ java -version
java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
reference
沒有留言:
張貼留言