Friday, 15 March 2013

Setting java path in linux

After installing JDK or JRE on Linux/Unix platform, you have to set PATH environment variable so that you can run the executables (javac.exe, java.exe, javadoc.exe, and so on) from any directory without having to type the full path of the command.
 Steps to set up java path in linux

1. Create a file in /etc/profile.d directory with content as follows: 
The file contains various shell commands which set and export necessary environment variables for Java. Shell settings from configuration files in the /etc/profile.d directory are gathered by/etc/profile during login, setting up user environment information for every user.  
2.  Assign execute permissions:
# chmod 755

3. You can verify the path  by typing the below command in the terminal

# java -version