What is path of JDK on Mac ?

On macOS, the path of the JDK (Java Development Kit) is typically /Library/Java/JavaVirtualMachines/jdk<version>.jdk/Contents/Home, where <version> is the version of the JDK.

For example, if you have JDK 8 installed on your Mac, the path of the JDK might be /Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home.

You can find the path of the JDK on your Mac by doing the following:

  1. Open a terminal window.
  2. Type the following command: /usr/libexec/java_home -v <version>, where <version> is the version of the JDK you want to find the path for.

For example, to find the path of JDK 8, you can type the following command:

/usr/libexec/java_home -v 1.8

This command will print the path of the JDK to the terminal.

Alternatively, you can also find the path of the JDK by looking for the java_home script in the /usr/libexec directory. This script is used to locate the JDK on your system.

You can also check the JAVA_HOME environment variable to find the path of the JDK. This variable is typically set to the path of the JDK when it is installed. You can check the value of the JAVA_HOME variable by typing the following command in the terminal:

echo $JAVA_HOME