This tutorial will guide you on how to install JDK (Java Development Kit) on Linux. Since I use Centos 5.4 x86_64 in everyday life, this guide is showing you how to install JDK in Centos 5.4 64bit. It must work in any other Linux distro.
If you install a Linux OS, the creators usually already included a JVM to the system to run some programs that need Java. Mostly they included OpenJDK for the JVM.
But I don’t like to use OpenJDK because some Java platform like JavaFX will not run using OpenJDK.
1. Download the JDK
The JDK can be downloaded from its official website. At the time this tutorial written, the JDK version is JDK 6 Update 17. Click the Download button then you will be forwarded to Java SE Downlaods page. You can select the Java platform to suit your system.
Since I use x86_64 of Linux, I choose ‘Linux x64′ for the platform. Then click ‘Continue’ button. You can skip for the ‘Log in for Downloads’ optional window. Then select from the available files.
Choose not the ‘rpm’ file because we will install the JDK in a folder as we like to.
2. After the download is complete, unpack the file by executing it. First you have to make it executable.
[fuad@centos Downloads]$ chmod +x jdk-6u17-linux-x64.bin [fuad@centos Downloads]$ ./jdk-6u17-linux-x64.bin inflating: jdk1.6.0_17/README.html creating: jdk1.6.0_17/include/ inflating: jdk1.6.0_17/include/jni.h creating: jdk1.6.0_17/include/linux/ inflating: jdk1.6.0_17/include/linux/jawt_md.h inflating: jdk1.6.0_17/include/linux/jni_md.h inflating: jdk1.6.0_17/include/jvmti.h inflating: jdk1.6.0_17/include/jawt.h inflating: jdk1.6.0_17/include/jdwpTransport.h inflating: jdk1.6.0_17/include/classfile_constants.h inflating: jdk1.6.0_17/COPYRIGHT Creating jdk1.6.0_17/jre/lib/rt.jar Creating jdk1.6.0_17/jre/lib/jsse.jar Creating jdk1.6.0_17/jre/lib/charsets.jar Creating jdk1.6.0_17/lib/tools.jar Creating jdk1.6.0_17/jre/lib/ext/localedata.jar Creating jdk1.6.0_17/jre/lib/plugin.jar Creating jdk1.6.0_17/jre/lib/javaws.jar Creating jdk1.6.0_17/jre/lib/deploy.jar Java(TM) SE Development Kit 6 successfully installed. Product Registration is FREE and includes many benefits: * Notification of new versions, patches, and updates * Special offers on Sun products, services and training * Access to early releases and documentation Product and system data will be collected. If your configuration supports a browser, the Sun Product Registration form for the JDK will be presented. If you do not register, none of this information will be saved. You may also register your JDK later by opening the register.html file (located in the JDK installation directory) in a browser. For more information on what data Registration collects and how it is managed and used, see: http://java.sun.com/javase/registration/JDKRegistrationPrivacy.html Press Enter to continue..... Done.
A folder ‘jdk1.6.0_17′ will be created.
We will move this folder to a place as you like. You can move it to /opt folder, stay in this directory or to anywhere in the system. I prefer to move this folder to /usr/local. So move it there.
[fuad@centos Downloads]$ sudo mv jdk1.6.0_17 /usr/local/
Here in the /usr/local/ directory, we will create a symbolic link to jdk1.6.0_17 named as ‘java’
[fuad@centos Downloads]$ cd /usr/local/ [fuad@centos local]$ sudo rm -f java [fuad@centos local]$ sudo ln -s jdk1.6.0_17 java
Now the JDK is installed in /usr/local/jdk1.6.0_17 and linked to /usr/local/java. We need to add PATH to the bin directory to your .bash_profile file to make the system PATH of Java.
Add or write a line in .bash_profile to be similar like below:
PATH=$PATH:$HOME/bin:/usr/local/java/bin
This file will automatically run on boot or you can set the PATH manually using a command below:
$ export PATH=$PATH:/usr/local/java/bin
Now you can call java directly from your shell:
$ java -version java version "1.6.0_17" Java(TM) SE Runtime Environment (build 1.6.0_17-b04) Java HotSpot(TM) 64-Bit Server VM (build 14.3-b01, mixed mode)
Incoming search terms for this post:
- jdk1 6 0_17 (22)
- jdk1 6 0_17 download (17)
- download jdk1 6 0_17 (8)
- jdk-6u17-linux-x64 bin (5)
- centos 5 4 jdk (5)
- centos 5 4 install jdk (5)
- jdk1 6 0_17 download linux (5)
- how to install java on centos 5 4 (4)
- jdk 1 6 0_17 download (3)
- jdk 1 6 0_17 centos 5 4 x64 (3)
- centos jni h (2)
- jdk1 6 0_17 folder (2)
- centos jdk loc (2)
- JDK 6 0_17 (2)
- install jdk 6 rhel 5 (2)
- command to install jdk1 6 linux (2)
- java jdk1 6 0_17 (2)
- install java jdk centos 5 4 (2)
- how to install jdk on centos 5 4 (2)
- how we install jdk in linux (2)





Comments