Install manual oracle java di debian atau ubuntu

Install java secara manual di debian atau ubuntu. Ketahui dulu OS yang terpasang 32 bit atau 64 bit

uname -m

Lalu arahkan browser ke alamat berikut http://www.oracle.com/technetwork/java/javase/downloads/index.html lalu download Oracle Java SE (Standard Edition), pilih JDK atau JRE sesuai kebutuhan. Pindahkan hasil download ke folder /opt/java, buat dulu folder java.

sudo mkdir /opt/java

#pindahkan file hasil download
sudo mv /tempat-download-file/jre-xxx-xxxx.tar.gz /opt/java

lalu ekstrak

cd /opt/java
tar -zxf jdk-xxx-xxxx.tar.gz

Setting oracle java sebagai default java

update-alternatives --install /usr/bin/java java /opt/java/jrexxx.xxxxx/bin/java 100
update-alternatives --install /usr/bin/javac javac /opt/java/jrexxx.xxxxx/bin/javac 100

verifikasi java

update-alternatives --display java
update-alternatives --display javac

cek versi java

java -version

update java

apabila kita upgrade dari versi sebelumnya lakukan perintah berikut :

update-alternatives --install /usr/bin/java java /opt/java/java-versi-baru/bin/java 110
update-alternatives --install /usr/bin/javac javac /opt/java/java-versi-baru/bin/javac 110

Setting java ke versi terbaru

update-alternatives --set java /opt/java/java-versi-terbaru/bin/java
update-alternatives --set javaws /opt/java/java-versi-terbaru/bin/javaws

dan kita bisa delete java versi sebelumnya

update-alternatives --remove java /opt/java/java-versi-sebelumnya/bin/java
update-alternatives --remove javac /opt/java/java-versi-sebelumnya/bin/javac

rm -rf /opt/java/java-versi-sebelumnya/

setting JAVA_HOME/PATH untuk single user

tambahkan script berikut ke file ~/.bashrc

export JAVA_HOME=/opt/java/jrexxx.xxxx/
export PATH=$PATH:/opt/java/jrexxx.xxxx/bin

lalu aktifkan

source ~/.bashrc

cek settingan

echo $JAVA_HOME
echo $PATH

<h3>setting JAVA_HOME/PATH untuk semua user</h3>
edit file <strong>/etc/profile</strong> tambahkan script berikut :

export PATH=$PATH:/opt/java/jrexxx.xxxx/bin

aktifkan

source /etc/profile

sumber :

  1. https://www.digitalocean.com/community/tutorials/how-to-manually-install-oracle-java-on-a-debian-or-ubuntu-vps
  2. http://www.cyberciti.biz/faq/linux-unix-set-java_home-path-variable/
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s