Technical details for https://stackoverflow.com/a/44169445/6730571
Details of investigation:
On a base system,
/usr/bin/java is a symlink that points to
/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, which is an Apple wrapper tool that locates and executes the actual
(Do not touch anything in those 2 system directories. It should actually be impossible due to "System Integrity Protection" anyway.)
If you don't have Java installed, attempting to execute
java will open a dialog that invites you to install it.