Skip to content

Understanding Path & JAVA_HOME

discorddioxin edited this page Apr 1, 2021 · 5 revisions

Contents


What is Path for?

Path is a list of directories that contain executable programs

When you run a command, such as

java -version

Your OS will look through the directories specified on the path for a program named java

You can find the location of the program by running the following command

  • Windows
where java
  • Linux & Mac
whereis java

If a folder containing Java is not defined on the Path...

  • Running java commands will display an error message "Cannot be found" or "Is not installed"

  • Running where commands will display an error message "Cannot find the files" or a blank path (such as java: with no actual value)

  • Double clicking a JAR file may result in nothing happening (since Java isn't properly installed)


Viewing what's on your system's Path

Open the terminal/command prompt on your machine

  • Windows (not case sensitive)
echo %path%

TODO- Include UI view

  • Linux & Mac (case sensitive)
$PATH

TODO - Include scoping


JAVA_HOME

TODO - Explain why JAVA_HOME is required by some programs


How would I change which Java my OS tries using?

TODO - Explain path priority

Clone this wiki locally