Error: Unable to access jarfile, and how to fix it

Updated 29 Sep 2026 · 3 min read

The short answer

Java prints Error: Unable to access jarfile when it can't open the file after -jar. There's no file by that exact name in the folder the command runs in, the path has a space and no quotes, or your user can't read the file. A file that's there but broken gives Invalid or corrupt jarfile instead.

1What Java is telling you

The name after "jarfile" is the file Java looked for, exactly as it read your command, and it's the first clue. On 29 Sep we ran each of these with Java 21 on Linux, next to Minecraft 1.21.1's server jar:

What we ranWhat Java said
java -jar server.jar, with no file of that name in the folderError: Unable to access jarfile server.jar
The same, where the file is really server.jar.jarError: Unable to access jarfile server.jar
java -jar Server.jar, where the file is server.jarError: Unable to access jarfile Server.jar
java -jar My Server/server.jar, without quotesError: Unable to access jarfile My
A jar the user isn't allowed to readError: Unable to access jarfile locked.jar
A download cut short, or a folder named .jarError: Invalid or corrupt jarfile broken.jar
A library's jar instead of a server'sno main manifest attribute, in netty-common-4.1.97.Final.jar

2The fix for each

  • Use the name the file really has. List the folder, with ls on Linux or dir on Windows, and copy the name from there. Windows hides known file extensions unless you turn them on in File Explorer's View menu, so a file renamed to server.jar there is often server.jar.jar. On Linux, Server.jar and server.jar are two different names.
  • Run the command in the jar's folder. A start script launched from somewhere else looks for the jar there. Our script failed when run from another folder, and worked once its first line was cd "$(dirname "$0")". In a Windows .bat file, cd /d "%~dp0" does the same.
  • Put quotes around a path with spaces: java -jar "My Server/server.jar" started the server where the same path without quotes stopped at My.
  • After an update, match the new name. Paper names each download after its version and build, like paper-1.21.1-133.jar, so a script that names the old build finds nothing. Rename the file, or change the script.
  • Let your user read the file. On Linux, ls -l server.jar shows who may, and chmod a+r server.jar lets everyone.
  • Invalid or corrupt jarfile: download it again. Our copy of the 51.6 MB server jar cut off after its first 100 kB gave that error. Mojang lists each server jar's SHA-1 and Paper each build's SHA-256, so sha1sum or sha256sum tells whether yours is whole.
  • No main manifest attribute: that's not the server. Plugins, mods and libraries are jars too. Run the server's own jar, or its installer for Forge and NeoForge.

3A full path works, but mind where the files go

java -jar /home/you/server/server.jar nogui starts the server from any folder. It then writes eula.txt, server.properties and logs, and later the world, into the folder the command ran in, not next to the jar: ours made them all in the other folder, and asked for the EULA there. So cd into the server's folder first, as the scripts above do.

4On a Playkeeper server

There's no java -jar to type. Playkeeper downloads each server's software itself, checks it before the first start, and starts it in its own container, with the Java that Minecraft version needs.

Questions

Why does it say Unable to access jarfile when the file is there?

Its real name differs, like server.jar.jar with Windows hiding the extension or a capital letter on Linux, the command runs in another folder, or your user can't read the file.

What's the difference from Invalid or corrupt jarfile?

Unable to access means Java couldn't open a file by that name at all. Invalid or corrupt means it opened one, but it isn't a whole jar: a download cut short, or a folder with a .jar name.

Where do a server's files go when I start it with a full path?

Into the folder the command runs in, not next to the jar. Change into the server's folder first.

A server that starts without a start script.

Free and open source. Playkeeper downloads and checks each server's software, then starts it for you.

curl -fsSL https://playkeeper.io/install | sudo sh
Try the live demo