Mac OS X – Find Java Location

Do you need to find out location of Java in your Mac? Its simple:

  1. Open Terminal
  2. Type the command: /usr/libexec/java_home
  3. Hit Enter/Return button
  4. If Java is available, then you will see results like this

OUTPUT:

/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home

Need to find specific version?

  1. Open Terminal
  2. Type the command: /usr/libexec/java_home -v 1.7
  3. Hit Enter/Return button
  4. If Java is available, then you will see results like this

OUTPUT:

/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home

What happens when specified version is not available?

  1. Open Terminal
  2. Type the command: /usr/libexec/java_home -v 1.8
  3. Hit Enter/Return button
  4. If Java is available, then you will see results like this:

OUTPUT:

Unable to find any JVMs matching version “1.8”.

Leave a Reply

Your email address will not be published. Required fields are marked *