JAVA_HOME or PATH or BOTH?

shubham srivastava picture shubham srivastava · Jul 21, 2017 · Viewed 9.6k times · Source

I was watching the Android development video and they asked us to install JDK and create JAVA_HOME environment variable. I already have MyEclipse installed and I previously had setup the PATH variable(giving it the directory of JDK), do I still need a JAVA_HOME variable ??? If yes then why ???

Answer

Alexey R. picture Alexey R. · Jul 21, 2017

Yes, you do need. PATH is usually used to lookup the executables so that you haven't to specify the whole path to execute. JAVA_HOME may be used by the scripts or IDEs to lookup libraries. You can specify JAVA_HOME and build path variable basing on it. E.g (depending on OS)

PATH=$PATH;$JAVA_HOME/bin