The following (possibly revised) procedure has been suggested in other forum posts:
sudo pacman -Sy jdk-openjdk
# Choose `Y` (Yes) to remove each conflicting package
sudo pacman -Syu
# Answer `Y` (Yes) to rename/replace all packages indicated.
I hope this helps.