Remove Java on your Mac

java -version
If you see 1.6 or 1.7 in the response, go to /System/Library/Java/JavaVirtualMachines/ directory and delete it.

Alternatively, use the command line:
sudo rm -rf /System/Library/Java/JavaVirtualMachines/

Learn more: “How to disable Java on your Mac