Pages

Showing posts with label java path. Show all posts
Showing posts with label java path. Show all posts

Thursday, September 4, 2014

Install Oracle Sun JDK in Ubuntu and set JAVA_HOME

To install JDK from Oracle use following steps:

1. Download JDK from Oracle web site:

http://www.oracle.com/technetwork/java/javase/downloads/index.html

2. Extract file will be of .bin format. For example - for 64-bit system we have jdk-6u37-linux-x64.bin.

3. Put this bin file in your home directory.

4. Now need to extract this file to use Java API.

5. Extract BIN file:
  • Make BIN file executable using this command: chmod +x jdk***.bin
  • For executing use: ./jdk***.bin

6. Same named folder will be created in the same directory.

7. Now need to provide JDK path to JAVA_HOME variable in .bashrc file.

8. Edit .bashrc file in editor use following command:

          gedit .bashrc

9. Now put this code in your .bashrc file:

           export JAVA_HOME=/home/jdk***
           export PATH=$JAVA_HOME/bin:$PATH

10. Save file.

11. To refresh your bash settings write this command and hit enter:

            bash

12. To verify configured JDK path use this command:

            which java

This will display your configured path i.e. /home/jdk***/bin/java