Pages

Wednesday, May 4, 2011

Manually install JDK on Ubuntu

Last time, I tried to install Net Beans on my Ubuntu, and of course I need JDK (Java Development Kit) to install it because the installer ask me too. Ok, I think I should install JDK manually on my Ubuntu because the  Net Beans installer I have is not the bundled version. Have you ever face the same problem like me? Then maybe you must hear my experience here.  Ok, I'll show you how to install JDK manually step by step.


Note: This guide only for Self Extracting Installer (.bin)

1. First, head to http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u25-download-346242.html and download the newest JDK for linux. Choose jdk-6uxx-linux-i586.bin (32 bit) or jdk-6uxx-linux-ia54.bin (64 bit).  The example below is for i386.

2. After download it, navigate to the folder where you download your JDK and give permission to execute it. For example if your download folders is Downloads, then..
~/$ cd Downloads
~/Downloads$ chmod +x jdk-6uxx-linux-i586.bin
note: change xx with your JDK version.

3. Next, open your terminal and type the code below to move it to your /opt folder:
~/Downloads$ sudo mv jdk-6uxx-linux-i586.bin /opt
note: change xx with your JDK version.

4. Navigate to /opt with cd /opt on your terminal and install the JDK with command:
./jdk-6xx-linux-i586.bin

5. Ok, now JDK is successfully installed. Next thing to do is create a symbolic link for your JDK folder. Why? This is very useful if you want to upgrade your JDK in the future, just change this symbolic link and everything is done! :D Type this code to create symbolic link for your installed JDK:
sudo ln -s jdk 1.6.0_xx jdk
note: the code above will create symbolic link with name "jdk" in your /opt directory, and of course 
don't forget to change xx with your JDK version.

6. Ok, now open your bash.bashrc file, type this code in your terminal:
sudo gedit /etc/bash.bashrc
and inside this file, add this code in the bottom of this file:
JAVA_HOME=/opt/jdk/
export JAVA_HOME
PATH=$PATH:$JAVA_HOME/bin
and then save the file and close.

7. Done! To check it, you can type echo $JAVA_HOME in your terminal and if the output is /opt/jdk, then you've successfully installed JDK manually. 

Nah, this is my experience. After manually install JDK, then I can install Net Beans on my Ubuntu because now I have installed JDK inside /opt directory. Just navigate it to /opt if your Net Beans installer ask you to specify your JDK directory.

Confused?
Then I suggest you to download JDK+Net Beans bundle here:
so you don't need to install JDK manually :)

Hope this help you guys :D

No comments:

Post a Comment