With macOS, Java can be in various places.
When installing a JDK*, it goes into /Library/Java/JavaVirtualMachines. For example, here are two JDKs installed:
diglloyd-MacPro:MPG lloyd$ ls -1 /Library/Java/JavaVirtualMachines/ jdk-13.0.2.jdk openjdk-13.0.2.jdk
* Using a JDK is prefered, because separate Java runtimes are poorly supported, and are generally old, like Java 8
Adding permissions for Java in macOS Catalina
Adding permissions for Java (e.g., the 'java' executable) is done the same way as for any other application. The only confusing thing is what to add, where.
For a JDK installed in /Library/Java/JavaVirtualMachines, the actual binary 'java' application is found several levels down:
So that’s what needs to be added, as shown below.