failed to uninstall Java: XPC Connection Error ("redux" ... solved)
"How very, very interesting." I just encountered this error when Java offered to update itself on my machine. The "automatic updater" recognized that an old version of Java was installed, offered to remove both it and the cache, and failed to do so with an "XPC Connection Error," after which it simply quit! (And basically disappeared altogether.)
(MacOS Monterey latest, etc.)
Anyhow, I followed the recommendations given in another now-closed thread on this forum, and it worked: go to the Oracle website, and first run the uninstaller ... which completed successfully. Next, run the installer, which also completed successfully.
"But to me, this is some kind of a bug that really should be reported to Oracle, if it hasn't already been." Their automatic-update process ought not encounter any sort of error ... particularly since the two-step process didn't. Let alone "fail and completely disappear!" (Note: I ran first the uninstaller, then the installer ... I did not try running their installer first. Maybe that's part of the bug – in their installer? Dunno.)
Anyhow: here's what I just encountered and here's what worked to solve the problem. (I recall having had this problem for quite some time, actually ... I just didn't bother to pay attention to it or try seriously to fix it.)