Tuesday, January 22, 2013
How to use PATH environment variable in Unix ?
What is the purpose of PATH? And how it can help Us ?
Consider that you want to export the executable resides inside Oracle JDK’s binary directory like java, jmap, jhat, jstack , etc …!
List of JDK’s binary Executable:
If you want to use this executable utilities then you need to navigate into this directory and run it like a normal shell scripts, like following:
[thiru@localhost ~]$ ./java
[thiru@localhost ~]$ ./jmap
In order to avoid this repetitive daunting task, we are going to export our Java binary executable directory to PATH.
How to implement this PATH concept in your Machine ?
[thiru@localhost ~]$ export PATH=/optional/Oracle/Middleware/jdk1.6.0_26/bin:$PATH
But this kind of exporting would only lost for this session, to make this as a permanent, include this command to .bash_profile of your unix user account.
Content of .bash_profile after PATH inclusion:
What are the steps involved ?
1] In most number of unix machines the default JAVA HOME would be /usr/bin/java.You can find out that using which command.
2] Once checking completed execute the edited .bash_profile using source(Read and Execute commands from file) command.
3] Use which command once again to know the new JAVA HOME which is assigned by us.
Steps Involved:
I hope that this can help someone, post if you have any queries or suggestions.
References:
1] http://www.cyberciti.biz/faq/unix-source-command/
No comments:
Post a Comment