Minecraft – script to determine Minecraft Server Jar Version

minecraft-java-editionminecraft-java-edition-server

I'm trying to find a way to determine the Minecraft Server version (ie. 12w40b, 1.4.5, etc) of a given Jar file without needing to start up the entire server process? (I have full control over the server, as I'm writing a basic admin interface)

  • Is there a command-line argument I can append to my java -jar ... command to have minecraft only print the version and exit?
  • Can I extract the Jar file and look/grep for a specific file?

UPDATE I've created an issue with the Minecraft Bug Tracker here, we'll see what happens from the Mojang team. 🙂

Best Answer

If you are on MacOSX or Linux, I think this command does pretty much what you want:

unzip -p server.jar version.json | grep "name"

In my case it responds with "name": "1.14.4",

If you are on Windows I assume you could do something similar with PowerShell