On OSX, in the terminal, using the command:

echo $PATH

Gives me the following output:

/Library/Frameworks/Python.framework/Versions/2.7/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/Applications/Android Studio.app/sdk/platform-tools

You can see that a reference to JAVA is no where in there. Yet in terminal, when I type:


It is seen as a valid command and outputs:

Usage: java [-options] class [args...] (to execute a class) or java [-options] -jar jarfile [args...] (to execute a jar file) where options include: -d32 use a 32-bit data model if available -d64 use a 64-bit data model if available -server to select the "server" VM The default VM is server, because you are running on a server-class machine.

My question is this, how is it recognizing my java command if it is not referenced in my PATH variable and it is not referenced in the directory my terminal instance is currently exploring?

Thank you for the help.

  • 1
    "With OS X, you know the Java Runtime is there for your applications, because it is built into the operating system" Source Sep 12, 2014 at 18:56

1 Answer 1


Java is in /usr/bin on my OSX 10.9.4 system:

$ which java

That directory is also in your command path.

The entry in /usr/bin is a symbolic link. Maybe you were expecting the actual java install directory to be in your path, but that doesn't have to be the case. Creating symbolic links in /usr/bin is a common practice.

$ ls -l /usr/bin/java
lrwxr-xr-x  1 root  wheel  74 May 17 17:02 /usr/bin/java -> 
  • 1
    Additionally, to check all installed and available JDK/SDK on your MacOSX, use the /usr/libexec/java_home -V command.
    – ikaerom
    Dec 27, 2014 at 22:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .