It seems that /usr/bin/java exists on my mac even though java isn't installed.
$ which java
/usr/bin/java
$ java --version
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.
$ ls -lah /usr/bin/java
-rwxr-xr-x 52 root wheel 164K Oct 18 05:36 /usr/bin/java
If there is no Java Runtime on my machine, then what is inside the /usr/bin/java file? Wouldn't it be better for /usr/bin/java to not exist when java is not installed?
I am pretty sure this is specific to mac, since I seem to remember when using other operating systems that when java isn't installed, the java command doesn't exist. (If that's not accurate, let me know and I can move this question to superuser.)
A good answer to this question will explain the difference and the relationship between the java command and the Java Runtime on macOS.
/usr/bin/java --version? I wondering if you have an issue with your PATH. – Allan Jan 27 '23 at 21:28