nix-minecraft
nix-minecraft copied to clipboard
Document how to change java package
Minecraft 1.20.5+ requires Java 21, but jre_headless
in nixpkgs 23.11 is Java 19. This causes the server to fail to start with an error like
net/minecraft/bundler/Main has been compiled by a more recent version of the Java Runtime (class file version 65.0), this version of the Java Runtime only recognizes class file versions up to 63.0
This can be fixed by overriding the jre_headless
input to the desired server package like
package = pkgs.fabricServers.fabric-1_20_6.override {
jre_headless = pkgs.temurin-jre-bin-21;
};
Maybe this could be made more convenient with some kind of javaPackage
option? Either way, it would be great to document a recommended approach.
I see that you probably already noticed some related issue here with https://github.com/Infinidoge/nix-minecraft/commit/d9ca459b3b87d2639407cef26bb8e94a1314f40e.