Search code examples
macosterminalosx-elcapitan

Having trouble getting java to work on Mac terminal


I am having trouble getting java to work. I type java -version into my terminal and get java: no such file or directory. My Mac OS X version is 10.11.1. I have the newest JDK installed 1.8.0_73 x64. I am trying to compile java files and eventually create a jar file. Tutorials just say to type in java -version. Is there something I am missing in order to use the JDK? Taylors-MacBook-Pro-4:~ Taylor$ java -version -bash: java: No such file or directory

EDIT: Echoing the $PATH gives me the following.

Taylors-MacBook-Pro-4:~ Taylor$ echo $PATH

Taylors-MacBook-Pro-4:~ Taylor$ 

Solution

  • It looks like your $PATH is not set properly if indeed java is installed. Type $ echo $PATH and see the list. Usually java is installed at /usr/bin/ or /usr/local/bin/ directory.