Your Codespace will Open once Ready

3 min read


- 2 commits



Native Minecraft Servers using GraalVM Native Image



The Minecraft server is known to require lots of memory and CPU resources and is difficult to deploy. This project allows you to convert the Minecraft server into a native executable using GraalVM. It is anticipated to utilize less memory and CPU resources, be faster to begin, and be more simple to deploy.



A native Minecraft server is smaller than Minecraft's server.jar and the JDK required to run it. this is what awesome looks like With upx compression, the size of the native executable may be reduced to less than 40MB, which is smaller than just the server.jar. Initial tests also showed a competitive run-time and a smaller footprint for memory. For the best results, use GraalVM Enterprise Native Image which is more efficient and lower memory consumption than the Community Edition, and try using the G1 GC and Profile-Guided Optimizations. The Oracle Cloud Free Tier provides four Ampere A1 cores and 24 GB of RAM that is enough to host an Minecraft server. It also gives you free access to GraalVM Enterprise.



For more information, see this blog post.



Disclaimer: This project is intended to be used for demonstration purposes only. It's intended to assist the Minecraft community assess the use of GraalVM Native Image. Use at your own risk.



1. Download GraalVM Community or Enterprise (GraalVM 22.2.0 or later is required). Optional: Ensure that upx is installed on your $PATH in order to enable compression 2. Check out the repository and download it. Then run build.sh. 3. Launch the native Minecraft server with ./native-minecraft-server. The first time you use the server, you will be required to follow the normal procedure of accepting Minecraft's EULA.



How does it work



This project only contains the build.sh script along with reachability metadata and instructions to build the native Minecraft server. The build.sh script downloads Minecraft's server.jar and extracts jars as well as other resources from it. It then calls GraalVM native image with the correct configuration to create an native Minecraft server. Finally, if upx is present on the $PATH the script will compress native executable.



Limitations and issues that are known



- The configuration currently only supports Minecraft 1.18.2. - The server GUI isn't implemented as of yet. Mods aren't supported at the moment. There isn't a built script for Windows yet, however the WSL should be able to work. The native executable occasionally fails to start upon startup. Restarting it several times usually helps. Error: com.mojang.datafixers.types.templates.List$ListType cannot be cast to java.lang.Comparable.

In case you have found a mistake in the text, please send a message to the author by selecting the mistake and pressing Ctrl-Enter.
Comments (0)

    No comments yet

You must be logged in to comment.

Sign In / Sign Up