Wednesday, January 16, 2013

Meng-install Oracle Java 8 (JDK & JRE) di Ubuntu 12.04

Install Oracle Java 8 (JDK & JRE) in Ubuntu 12.04
from :

Here’s a quick update. The next version of Oracle Java will be released next year (2013), but you don’t have to wait to install it.

This brief tutorial is going to show you how to install both Oracle JDK8 and JRE8 in Ubuntu 12.04 (Precise Pangolin) via PPA provided by Webupd8. This is a pre-release version and should only be used for testing purposes, and might include bugs and other problems.

This PPA supports Ubuntu 12.10, 12.04, 11.10, 11.04, 10.10 and 10.04.

To get started, press Ctrl – Alt – T on  your keyboard to open the terminal. When it opens, run the commands below to add the required PPA.

sudo add-apt-repository ppa:webupd8team/java

Finally, run the commands below to update your system and install Java.

sudo apt-get update && sudo apt-get install oracle-java8-installer

To verify if Java is installed, run the commands below.

java –version


Install Java JDK 7 in Ubuntu 12.04

This package provides Oracle Java JDK 7 (which includes JRE and the Java browser plugin). However, you can’t only install Oracle JRE – the PPA only provides the full Oracle JDK7 package.

1. To add our PPA and install the latest Oracle Java (JDK) 7 in Ubuntu, use the commands below:
#sudo add-apt-repository ppa:webupd8team/java

#sudo apt-get update && sudo apt-get install oracle-jdk7-installer

2. After install you have enable the jdk:
#update-alternatives –display java

3. Check if Ubuntu uses Java JDK 7
#java -version

If all went right the answer should be:
java version “1.7.0_07″

Java(TM) SE Runtime Environment (build 1.7.0_07-b10)
Java HotSpot(TM) Server VM (build 23.3-b01, mixed mode)

4. Check what compiler is used:
#javac -version

The correct answer:
javac 1.7.0_07

5. Adding JAVA_HOME to environment
/etc/environment and add JAVA_HOME=/usr/lib/jvm/java-7-oracle to the end of the file.
First open a Terminal (Applications → Accessories → Terminal), then enter:
#sudo gedit /etc/environment

Append to the end of the file: JAVA_HOME=/usr/lib/jvm/java-7-oracle
6. Removing Oracle JDK 7
If you don’t want to use Oracle Java (JDK) 7 anymore and want to go back to OpenJDK, all you have to do is remove the Oracle JDK7 Installer and the previous Java (OpenJDK, etc.) version will be used:
#sudo apt-get remove oracle-jdk7-installer

Artikel Terkait