Linux搭建Spigot Minecraft服务器:start.sh脚本报错无法访问spigot.jar
Hey there, let's break down why you're hitting that frustrating error when trying to launch your Spigot server. Here are the most common culprits and how to fix them:
You're running the script from the wrong directory
Linux is strict about your current working directory. If yourstart.shis stored in a different folder thanspigot.jar, or you execute the script from a parent/other directory entirely, Java won't know where to locate the jar file.
Fixes:- Navigate to your server folder first with
cd /path/to/your/server/directory, then run./start.sh. - Edit your
start.shto use the absolute path of the jar file. For example, change-jar spigot.jarto-jar /home/yourusername/minecraft-server/spigot.jar. - Add
cd /path/to/your/server/directoryas the first line instart.shto ensure it always runs from the correct location.
- Navigate to your server folder first with
Filename spelling or capitalization doesn't match
Linux is case-sensitive! If your actual jar file is namedSpigot.jar,spigot-1.20.2.jar, or anything else that doesn't exactly matchspigot.jar, Java will throw this error.
Fix: Runlsin your server directory to see the exact filename, then update the-jarline instart.shto match it perfectly.File permissions are blocking access
Even if the jar exists, your user might not have permission to read it.
Fix: First, check permissions withls -l spigot.jar(if the file exists). You should see something like-rw-r--r--(read access for all users). If not, runchmod 644 spigot.jarto set proper read permissions. Also make sure your user has access to the server directory itself.The spigot.jar file doesn't exist at all
It's easy to skip or botch the BuildTools step from the Spigot tutorial. If you didn't successfully compile or download the jar file, it won't be present in your server folder.
Fix: Runlsin the server directory—ifspigot.jarisn't listed, go back through the tutorial's BuildTools steps to generate the jar, making sure the compilation process finishes without errors.
内容的提问来源于stack exchange,提问作者Jeff Ru

