The easiest way to do this is through nano, the built-in text editor on Raspberry Pi devices.
To do this, type the line:
Next, enter this code:
java -Xmx1024M -Xms1024M -jar server.jar
This snippet of code creates a loop that turns the server on and then if it ever crashes, reboots it after 10 seconds. This ensures you won’t have to continually fiddle with the server if it crashes for any reason.
Next, we will want to make the server executable to all users and make the server instantly boot. Set mcstart.sh to be executable by all users:
Chmod a+x mcstart.sh
Next, set it to automatically boot with:
Lastly, restart the Raspberry Pi and see if the installation went smoothly. If all goes well, then you are ready to get the server onto the internet.