Linux - How to set java path in linux, Linux set jdk env variable

How to set java path in linux


How to Set JAVA_HOME / PATH variables Under Linux Bash Profile?

Set JAVA_HOME / PATH for single user
Login to your account and open .bash_profile file
 $ vi ~/.bash_profile

Set JAVA_HOME as follows using syntax export JAVA_HOME=. If your path is set to /usr/java/jdk1.5.0_07/bin/java, set it as follows:
 export JAVA_HOME=/usr/java/jdk1.5.0_07/bin/java

Set PATH as follows:
 export PATH=$PATH:/usr/java/jdk1.5.0_07/bin
Save and close the file. Just logout and login back to see new changes:
  $ echo $JAVA_HOME
  $ echo $PATH

Use the following command to find out exact path to which java executable under UNIX / Linux:
  $ which java

Set JAVA_HOME / PATH for all user

You need to setup global config in /etc/profile OR /etc/bash.bashrc file for all users:
  $ vi /etc/profile

Next setup PATH / JAVA_PATH variables as follows:
export JAVA_HOME=/usr/java/jdk1.5.0_07/bin/java
export PATH=$PATH:/usr/java/jdk1.5.0_07/bin
Save and close the file.

The topic on Linux - How to set java path in linux is posted by - Math

Hope you have enjoyed, Linux - How to set java path in linuxThanks for your time

Tech Bluff