zazagg
zazagg

Reputation: 121

Where is java installed on Mac. I can't find it

I have successfully installed java. When I type in the terminal:

java -version

I get: java version "14.0.1" 2020-04-14. But I don't know where it is installed.

When I type :

echo $(/usr/libexec/java_home)

to get the path it shows me: /Library/Java/JavaVirtualMachines/jdk-14.0.1.jdk/Contents/Home but in the folder Library isn't the folder Java : -bash: cd: Java: No such file or directory*

Upvotes: 12

Views: 31573

Answers (4)

Raj Kumar Ram
Raj Kumar Ram

Reputation: 11

  1. Install Java
  2. java -version openjdk version "17.0.5" 2022-10-18 LTS OpenJDK Runtime Environment AppleJDK-17.0.5.8.2 (build 17.0.5+8-LTS) OpenJDK 64-Bit Server VM AppleJDK-17.0.5.8.2 (build 17.0.5+8-LTS, mixed mode, sharing)
  3. whereis java java: /usr/bin/java
  4. /usr/libexec/java_home -V Matching Java Virtual Machines (6): 17.0.5.8.2 (x86_64) "Apple Inc." - "AppleJDK 17" /Library/Java/JavaVirtualMachines/applejdk-17.0.5.8.2.jdk/Contents/Home
  5. This is the Java installed location /Library/Java/JavaVirtualMachines/applejdk-17.0.5.8.2.jdk/Contents/Home

Upvotes: 1

Kumar Anil Chaurasiya
Kumar Anil Chaurasiya

Reputation: 351

Simply, type java -verbose in terminal, you will get the java installation location in the first line.

Upvotes: 3

Arvind Kumar Avinash
Arvind Kumar Avinash

Reputation: 79580

Execute the following command on Mac Terminal:

/usr/libexec/java_home -V

It will show you all the versions of JDK installed in your Mac.

Now, let's say it shows you paths like as given below:

/Library/Java/JavaVirtualMachines/jdk-14.0.1.jdk/Contents/Home

Execute the following command:

cd /Library/Java/JavaVirtualMachines/
ls

Upvotes: 17

V. Mokrecov
V. Mokrecov

Reputation: 1094

Successful result of commands on my Mac:

enter image description here

Upvotes: 1

Related Questions