penting: use root access pls. ^^

Cek OS untuk menentukan jdk mana yg dibutuhkan. Keterangan di bawahnya menandakan bahwa OS saya 64 bit, otomatis menggunakan jdk 64 bit. SunJDK bisa di download disini.

>> uname -a
Linux Serverarium 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 00:31:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

Cek apakah sudah ada JDK yg terinstall, dengan mengetik java -version. Jika belum terinstall, maka tidak akan muncul apa-apa, keterangan di bawahnya menandakan bahwa sudah ada jdk yang terinstall.

>> java -version
 java version "1.7.0_09-icedtea"
 OpenJDK Runtime Environment (rhel-2.3.4.1.el6_3-x86_64)
 OpenJDK 64-Bit Server VM (build 23.2-b09, mixed mode)

Copy JDK ke folder /urs/lib/jvm (jika foldernya sudah ada)

>> cp ./jdk-6u45-linux-x64.bin /usr/lib/jvm

Jika foldernya belum ada, buat folder dulu dengan:

>> mkdir -p /usr/lib/jvm

Ubah permission agar dapat di execute:

>> chmod 755 jdk-6u45-linux-x64.bin

Eksekusi (install)

>> ./jdk-6u45-linux-x64.bin [enter]

Remove file .bin installer yg ada di dalam folder jvm

>> rm -rf jdk-6u45-linux-x64.bin

Cek ada bearapa java version yg terinstall, dan mana yg dipakai

>> sudo update-alternatives --config java

Cek ada bearapa java version yg terinstall, dan mana yg dipakai

>> sudo update-alternatives --config java
There are 3 programs which provide 'java'.
  Selection    Command
-----------------------------------------------
*+ 1           /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java
   2           /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
   3           /usr/lib/jvm/jre-1.5.0-gcj/bin/java
Enter to keep the current selection[+], or type selection number: 1

Dari list, sunJDK yg tadi di execute belum di terinstall. Jalankan perintah ini (pake root akses)

>> update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.6.0_45/bin/java" 1
>> update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.6.0_45/bin/javac" 1
>> update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.6.0_45/bin/javaws" 1

Ulangi perintah update-alternatives –config java, dan pilih sunJDK yg sudah diinstall

>> update-alternatives --config java
There are 4 programs which provide 'java'.
Selection    Command
-----------------------------------------------
*+ 1           /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java
2           /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
3           /usr/lib/jvm/jre-1.5.0-gcj/bin/java
4           /usr/lib/jvm/jdk1.6.0_45/bin/java
Enter to keep the current selection[+], or type selection number: 4

Cek dengan perintah java -version

>> java -version
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)

JDK kita sudah sunJDK, namun dengan JAVA_HOME belum di set, untung optimasi memori JVM dll sebaiknya melakukan set JAVA_HOME. Edit file ~/.bashrc, misal dengan perintah vi [root akses]

>>vi ./.bashrc

Sisipkan line ini:

export JAVA_HOME=/usr/lib/jvm/jdk1.6.0_45

Untuk me reload, dan system mengenali perubahan yang dilakukan ketik ini [root akses]:

>> source ./.bashrc

Cek dengan mengetik echo $JAVA_HOME

>> echo $JAVA_HOME
 /usr/lib/jvm/jdk1.6.0_45

reference:
[1] http://askubuntu.com/questions/55848/how-do-i-install-oracle-java-jdk-7
[2] http://johnbokma.com/mexit/2011/06/24/oracle-java-jdk-installation-ubuntu.html

Tagged with:
 

Leave a Reply

Your email address will not be published. Required fields are marked *

Set your Twitter account name in your settings to use the TwitterBar Section.