for removing the java runtime you need to copy these two lines in your terminal
sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo rm -fr /Library/PreferencePanes/JavaControlPanel.prefpane
then if you open the system prefrences you can see the java icon is gone
The java development kit is different than the runtime, and to remove that, you’ll need to run a different command and look in a different folder to see if it even is installed (usually it’s not). Open up a Terminal window and type in (or paste) the following command to switch to the correct folder:
cd /Library/Java/JavaVirtualMachines
And then use “ls” at the prompt to see if there is anything in there. if there was. So then you’ll type in the following:
sudo rm -rf jdk1
And then use the TAB key to make the shell complete the file name.
It’s easy enough to make sure that Java is completely dead. You should already have noticed that closing and reopening System Preferences is enough to make the icon there go away, but to be really sure, you can open up a terminal and simply type “java”. You’ll be presented with the message, “No Java runtime present, requesting install”.
And then a little dialog box will pop up with the OK button highlighted, indicating that everything is going to be OK now.