Friday, October 23, 2015

How to install JDK in Linux

INTRODUCTION

This post will be the step by step guide to install the JDK in Linux Platform.
  1. DOWNLOAD

Download jdk-7u79-linux-x64.tar.gz file the oracle website.
  1. INITIAL SETUP

Create a new folder 'java' under /usr
  1. UNZIP THE DOWNLOADS

Unzip jdk-7u79-linux-x64.tar.gz to /usr/java
Now the folder structure would be  /usr/java/jdk1.7.0_79
  1. SET JAVA_HOME

    1. Check already set or not => $ echo $JAVA_HOME
    2. If Not, => $ export JAVA_HOME=/usr/java/jdk1.7.0_79
    3. Check JAVA_HOME now => $ echo $JAVA_HOME
/usr/java/jdk1.7.0_79
  1. SET CLASSPATH VARIABLE

  1. Check already set or not => $ echo $CLASSPATH
  2. If Not,  => $ export CLASSPATH=$JAVA_HOME'\lib'
  3. Check CLASSPATH now => $ $ echo $CLASSPATH
/usr/java/jdk1.7.0_79\lib
  1. SET PATH VARIABLE

  1. Check already set or not => $ echo $PATH
  2. If not, => $ export PATH=$JAVA_HOME'\bin'
by default there will be some PATH variable set already, then do as 6.4
  1. Check PATH now => $ $ echo $PATH
/usr/java/jdk1.7.0_79/bin
  1. If already PATH set, then $ export PATH=$PATH:$JAVA_HOME'/bin'
<existing path variables>:/usr/java/jdk1.7.0_79/bin
Now you will be able to run any java program in Linux. Please reply in comment box if you are facing any error during any of the above steps.

No comments :

Post a Comment