All versions
Java 21
Minecraft 1.20.6 was released on 2024-04-29. Mojang's version file lists Java 21 for it, for both the game and a server.
See which Java you have:
java -version
Download Java 21 from Adoptium