Wednesday, February 4, 2015

Why PATH :..;%JAVA_HOME%\bin;?

It is all about setting up PATH variable for JAVA_HOME with some interesting facts. I had some questions about things related to this topic long time ago. And I wanted to share the things I have found out related to the topic with you all.


1. What is this variable 'PATH' ?
  • It is the system variable that operating system uses to locate the required executables from the command line. 
  • The value assign for that is series of directories separated by semicolons. 
2. Is it necessary to setup PATH variable once we have installed the jdk ? and Why ?
  • Actually it is not necessary, but it is convenient for us :)
  • If you do not set the PATH variable, you need to specify the full path to the executable every time you run it.
  • If you do set the PATH variable you can conveniently run the executables from any directory without typing the full path in the terminal.  
3. Why we set the path for the JAVA to the 'bin' directory in jdk installation ?
  • Because Java compiler and interpreter executables are placed in the 'bin' directory. So that Windows can find them. 

4. How can we setup PATH variable for java in Windows??
  • Select Start -> Computer -> System Properties -> Advanced system settings -> Environment Variables -> System variables 
  • You can introduce new System variable as JAVA_HOME and give the path to the jdk or you can edit the PATH variable it self. I used the first method.


  • Then select the PATH system variable and add a semicolon to the end of the existing value and then put the %JAVA_HOME%\bin as follows.
  • Finally check that you have setup it correctly, type the java -version in the terminal and check the installed jdk version details. 
  • Now you are done with the setting up PATH for the JAVA_HOME.Go home safely and play with JAVA !! ;)


Cheers!!
'do good and good will come to you'


No comments: