Minecraft wiki entry for Setting_up_a_server, associated text: Check if you have java by running java -version. Make sure it's newer than 1.6 (best if newer than 1.8), for most versions, or java 17+ on 1.17 & 1.18.