How to Set Java Home and Path in Linux

This small article will describe how to set the Java Path in Linux.

  1. Open '/etc/profile' file
  2. Add following line at the end of this file
    1. export JAVA_HOME=/usr/java/jdk1.6.0_33                                              export PATH=$PATH:/usr/java/jdk1.6.0_33/bin
    2. Change the path of JDK as per your installation
  3. This should set the path
  4. If it is not solving your problem, 
  5. Open '/etc/bashrc' file
  6. Add following line at the end of this file
    1. export JAVA_HOME=/usr/java/jdk1.6.0_33
      export PATH=$PATH:/usr/java/jdk1.6.0_33/bin
    2. Change the path of JDK as per your installation
  7. If it still does not resolve the motive,
  8. Open directory '/etc/profile.d'
  9. Create a file 'java.sh' here (if it is not there)
  10. Add following lines to this file
    1. JAVA_HOME=/usr/java/jdk1.6.0_33
      PATH=$JAVA_HOME/bin:$PATH
      export JAVA_HOME
      export PATH
Scripts located in 'profile.d' directory runs in the end and hence override any other settings done. So it should finally help to have the Java Home set in system.

People who read this post also read :



0 comments:

Post a Comment