# Error: Unable to Access Jarfile — How to Fix It

> Java can't find or read the JAR you named. Fix the wrong folder, hidden .jar.jar extensions, spaces in the path and Run-as-administrator start scripts.

Source: https://jar.tools/kb/unable-to-access-jarfile

*Reading time: ~4 minutes • Last updated: October 2026*

---

`Error: Unable to access jarfile server.jar` means Java could not find the file you named, or could not read it. Java never opened the JAR, so the file itself is not the problem yet. Something is wrong with the name, the folder you ran the command from, or access to the file. It shows up most often when starting a Minecraft server from `start.bat`, but any `java -jar` command can hit it.

---

## Step 1: Check You Are in the Right Folder

`java -jar server.jar` looks for `server.jar` in the **current folder** of the terminal, not in the folder where the script or file lives.

```bash
# Windows (Command Prompt): show the current folder and list JARs in it
cd
dir *.jar

# macOS / Linux: same check
pwd
ls -la *.jar
```

If the JAR is not listed, move into its folder first, or pass the full path:

```bash
# Windows: /d also switches drive (C: to D:)
cd /d "D:\Minecraft Server"
java -jar server.jar nogui

# macOS / Linux
cd ~/minecraft-server
java -jar server.jar nogui
```

---

## Step 2: Check the Exact File Name

The name in the command has to match the file exactly. Three mismatches cause most of these errors:

1. **The download has a version in its name.** You typed `server.jar`, but the file is `paper-1.21.4-232.jar` or `minecraft_server.1.21.jar`. Rename the file or change the command.
2. **Windows hides extensions, so the file became `server.jar.jar`.** Explorer showed `server`, you renamed it to `server.jar`, and Windows kept the real `.jar` on the end. Turn on **View → Show → File name extensions** in Explorer to see the full name.
3. **The download is unfinished or got a different extension.** `server.jar.crdownload`, `server.jar.part` or `server.zip` are not JARs to Java. Let the download finish, or download again.

`dir *.jar` (Windows) or `ls *.jar` (macOS/Linux) shows the exact names. Copy from that output instead of typing the name.

---

## Step 3: Quote Paths With Spaces

Without quotes, Java reads `C:\My Server\server.jar` as two arguments and looks for a file called `C:\My`.

```bash
# Wrong: stops at the space
java -jar C:\My Server\server.jar

# Right
java -jar "C:\My Server\server.jar"
```

The same applies on macOS and Linux: `java -jar "/Users/you/My Server/server.jar"`.

---

## Step 4: Fix the Start Script (start.bat / start.sh)

A start script that worked yesterday can fail after you right-click it and choose **Run as administrator**. Windows then starts the script in `C:\Windows\System32`, where there is no `server.jar`. Make the script switch to its own folder first:

```bat
@echo off
rem Switch to the folder this script is in, whatever folder it was started from
cd /d "%~dp0"
java -Xmx4G -jar server.jar nogui
pause
```

The macOS / Linux equivalent:

```bash
#!/bin/sh
# Switch to the folder this script is in
cd "$(dirname "$0")"
java -Xmx4G -jar server.jar nogui
```

Make it executable once with `chmod +x start.sh`.

---

## Step 5: Check the File Can Be Read

If the name and folder are right and the error stays, Java cannot read the file:

- **Antivirus quarantined it.** The file shows up in a listing but cannot be opened, or it disappears soon after downloading. Check the antivirus quarantine list.
- **It is a cloud placeholder.** OneDrive, iCloud and Dropbox can keep a file listed while the content is still online. Right-click → **Always keep on this device**, or move the server folder out of the synced folder.
- **No read permission (macOS / Linux).** Fix it with `chmod +r server.jar`, and check the folder owner if you copied it as root.

---

## A Different Error? Check Which One You Have

| Message | What it means | Where to go |
|---------|---------------|-------------|
| `Unable to access jarfile` | File not found or not readable | This page |
| `Invalid or corrupt jarfile` | File found, but it is not a valid JAR (broken or wrong download) | [JAR File Won't Open?](https://jar.tools/kb/jar-file-wont-open) |
| `no main manifest attribute` | Valid JAR, but it does not say which class to start | [Executable JAR Not Working?](https://jar.tools/kb/executable-jar-not-working) |
| `UnsupportedClassVersionError` | Your Java is older than the JAR needs | [Which Java Version Does a JAR Need?](https://jar.tools/kb/which-java-version-for-jar) |
| `'java' is not recognized` / `java: command not found` | Java is not installed or not on PATH | [How to Run a JAR File](https://jar.tools/kb/run-jar-file) |

To check that a downloaded JAR is a real, complete archive before running it, open it in the [JAR Viewer](https://jar.tools/jar-viewer). If the file tree loads and `META-INF/MANIFEST.MF` names a `Main-Class`, the file is fine and the problem is the command or the folder.

---

## Summary

| Cause | Fix |
|-------|-----|
| Wrong folder | `cd` into the JAR's folder, or use the full path |
| Version in the file name | Rename the file or change the command |
| Hidden `.jar.jar` extension | Show file name extensions in Explorer, rename |
| Unfinished download | Re-download; check for `.crdownload` / `.part` |
| Space in the path | Put the path in quotes |
| Run as administrator | Add `cd /d "%~dp0"` to `start.bat` |
| Antivirus / cloud sync / permissions | Restore from quarantine, keep the file local, `chmod +r` |

> **Check the JAR itself:** [Open the JAR Viewer →](https://jar.tools/jar-viewer)

> **Related:** [How to Run a JAR File](https://jar.tools/kb/run-jar-file) · [How to Run a Minecraft JAR File](https://jar.tools/kb/how-to-run-minecraft-jar) · [Executable JAR Not Working?](https://jar.tools/kb/executable-jar-not-working) · [JAR File Won't Open?](https://jar.tools/kb/jar-file-wont-open)
