Minecraft wiki entry for Setting_up_a_server, associated text: sudo apt update; sudo apt-get install openjdk-8-jdk-headless below Minecraft Server 1.17
sudo apt update; sudo apt install openjdk-16-jdk-headless at or above Minecraft Server 1.17