How to set JAVA_HOME on Linux

    1. Login to the system
    2. Open a terminal window
    3. Open .bash_profile file for editing
      # vim ~/.bash_profile
    4. Set JAVA_HOME as following: export JAVA_HOME=<path to java>
      export JAVA_HOME=/usr/bin/java
    5. Set PATH as following:
      export PATH=$PATH:/usr/bin/java
    6. Save and close the file. Relogin in order to apply changes
    7. Alternatively use the following to activate new changes:
      # source ~/.bash_profile
      # . ~/.bash_profile

TIP: To find out exact path of java executable use the command as follows:
# which java


Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s