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:
java
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.
Answer
Java is in /usr/bin on my OSX 10.9.4 system:
$ which java
/usr/bin/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 ->
/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java
No comments:
Post a Comment