That's an odd error. What version of Java are you using?
Regardless, you can't allocate all 1024MB of RAM to the Java heap. First of all, that leaves no memory for the OS, and secondly, Java uses RAM outside the heap as well. Oh, and let's not forget the GPU needs at least 16MB of RAM. So you are trying to allocate 1024MB on a system that only has 1008MB available (before the OS and Java are loaded).
That's the biggest mistake I see when trying to build or run a Minecraft server on a Pi. I don't know who was responsible for the original error, but everyone seems to copy and repost the same nonsense in guides. The Raspberry Pi 2B, 3B and 3B+ computers only have 1GB (1024MB) of system RAM, and at least 16MB of that needs to be reserved for the GPU (default is actually 64MB).
It's been awhile since I've tried to build Spigot, but I do recall some memory issues when using newer versions of BuildTools.jar.
Give me a sec to look for my old build script and I'll update this post if I find anything...
I just successfully built SpigotMC for version 1.12.2 (used on my Creeper Pie SMP server
Try building your server with the following:
Code: Select all
java -Xmx640M -jar BuildTools.jar --rev 1.7.10
And don't make the same mistake when you run your server (leave some RAM for the OS and Java outside the heap). I suggest using 800 MB as the max when running the server (-Xmx800M).
This is the script I use to run my headless Creeper Pie server on a 3B+ with Raspbian Stretch Lite.
Code: Select all
# Run a Spigot Minecraft server on screen session "minecraft"
if ! screen -list | grep -q "minecraft"; then
screen -S minecraft -d -m java -jar -Xms640M -Xmx800M spigot-1.12.2.jar nogui
screen -r minecraft
I run it in a screen session so I can SSH into the system to control the server and logout without affecting the server. My server has been running since 2017 and has been very stable for myself and a few friends.
B.Goode wrote: ↑
Thu Apr 04, 2019 7:49 am
That command that gives you an error does not appear in the tutorial you claim to be following.
Yes it does. It's in the section about building the server (which, BTW, is SpigotMC).
Although I just noticed another problem with the tutorial. The sudo command is not needed to build or run the server (and should not be used on anything inside the user's home directory). Oh wait, I see what they did. They created a Minecraft folder outside the user's directory. Mine is in my user's folder (~/Minecraft), so I don't need sudo.
Here is the script I wrote to build the latest SpigotMC 1.12.2 server.
Code: Select all
# Build the SpigotMC server for Minecraft Java Edition version 1.12.2
rm -vfr *
echo Downloading the latest BuildTools.jar
echo Building Spigot/Craftbukkit...
git config --global --unset core.autocrlf
java -Xmx640M -jar BuildTools.jar --rev 1.12.2
echo Backing up old Spigot/Craftbukkit...
cp -vf spigot-backup.zip /mnt/Backup/spigot-backup.zip
zip -uv spigot-backup.zip spigot-1.12.2.jar craftbukkit-1.12.2.jar
echo moving files to the Minecraft folder...
mv -fv ~/Spigot/craftbukkit-1.12.2.jar ~/Minecraft
mv -fv ~/Spigot/spigot-1.12.2.jar ~/Minecraft
echo Backing up world saves...
zip -urv Mushroom.zip Mushroom Mushroom_nether Mushroom_the_end
echo All finihed, re-launch Spigot Minecraft server in 10 seconds.
I'm guessing the OP's error is due to either an incompatible Java or an old version of BuildTools.jar.
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?