I can’t tell you how many times I have logged in to a computer just to see five or more versions of Java installed going back multiple versions. To uninstall ALL of them in one fell swoop without being prompted, I use this command:

wmic product where "name like 'Java%%'" call uninstall /nointeractive