# "jar: command not found"

> Getting 'jar: command not found' or 'java: command not found'? Fix a missing JDK and PATH on Windows, Mac, and Linux — or skip the CLI and work online.

Source: https://jar.tools/kb/jar-command-not-found

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

---

`jar: command not found` (or `'jar' is not recognized as an internal or external command` on Windows) means your shell can't find the `jar` tool. The cause is almost always one of two things: you have a **JRE but not a JDK** (the `jar` command ships only with the JDK), or the JDK's `bin` folder isn't on your `PATH`. This page fixes both — and shows how to do common `jar` tasks online when you don't want to touch the CLI at all.

---

## Quick Check: JRE vs JDK

The `java` command comes with both the JRE and the JDK. The `jar` command comes **only with the JDK**. So this is a common state:

```bash
java -version   # works
jar --version   # "command not found"
```

If that's you, you have a runtime but not the developer kit. Install a JDK.

If `java -version` fails too, Java itself is missing. See the next section.

---

## "java: command not found" (No Java at All)

`bash: java: command not found` (Linux, macOS) or `'java' is not recognized as an internal or external command` (Windows) means no Java runtime is installed, or it is installed somewhere your shell doesn't look. Nothing that starts with `java -jar` will run until this is fixed.

**Linux:** install a JDK from your package manager. It includes both `java` and `jar`:

```bash
# Ubuntu / Debian
sudo apt install openjdk-21-jdk

# Fedora / RHEL
sudo dnf install java-21-openjdk-devel

# Arch
sudo pacman -S jdk21-openjdk
```

If Java is installed but the command is still not found, it is a PATH or alternatives problem:

```bash
# Find any installed java binaries
ls /usr/lib/jvm/

# Debian / Ubuntu: pick which installed Java the java command points to
sudo update-alternatives --config java

# Or add the JDK bin folder to PATH (add this line to ~/.bashrc to keep it)
export PATH="/usr/lib/jvm/java-21-openjdk-amd64/bin:$PATH"
```

Over SSH or in a Docker container, the image often has no Java at all. A minimal image needs an explicit install step, for example `apt install openjdk-21-jre-headless` for a server that only runs JARs.

**macOS:** typing `java` on a Mac with no JDK shows "No Java runtime present" or offers to install one. Install a JDK (Temurin's `.pkg`, or `brew install openjdk`), then confirm the system can find it:

```bash
# List the JDKs macOS knows about
/usr/libexec/java_home -V
```

Homebrew's `openjdk` is not linked into the system Java folder automatically. Follow the `ln -sfn` command that `brew info openjdk` prints, or add its `bin` folder to `PATH` in `~/.zshrc`.

**Windows:** install a JDK (`winget install EclipseAdoptium.Temurin.21.JDK`), tick **Add to PATH** in the installer, then open a **new** terminal. If you only need to run JARs, a JRE is enough: [Download Java (JRE) Offline Installer](https://jar.tools/kb/download-java-jre-offline-installer).

---

## Option 1: Do It Online (No JDK Needed)

If you reached for `jar` to look inside, extract, or repackage an archive, you can do all of that in your browser with no install.

| You ran `jar` to... | Do it online |
|---------------------|--------------|
| `jar tf` (list contents) | [JAR Viewer](https://jar.tools/jar-viewer) — browse the tree |
| `jar xf` (extract) | [Extract a JAR File](https://jar.tools/kb/extract-jar-file) |
| `jar cf` (create/repackage) | [How to Create a JAR File](https://jar.tools/kb/how-to-create-jar-file) |
| decompile classes | [JAR Decompiler](https://jar.tools/jar-decompiler) |

**Best for:** One-off tasks where installing a full JDK is overkill.

---

## Option 2: Install a JDK

Install a JDK (Adoptium Temurin, Microsoft Build of OpenJDK, or Oracle). After installing, both commands should work:

```bash
java -version
jar --version
```

If `java` works but `jar` still doesn't after installing a JDK, it's a PATH problem — see below.

---

## Option 3: Fix Your PATH

The `jar` binary lives in the JDK's `bin` folder. If that folder isn't on your `PATH`, the shell can't find it.

**Linux / macOS** — find the JDK and add its `bin` to PATH:

```bash
# Locate the active java binary, then derive the JDK bin folder
which java
# Add the JDK bin to PATH for the current shell
export PATH="/path/to/jdk/bin:$PATH"
```

Make it permanent by adding that `export` line to `~/.zshrc` or `~/.bashrc`. On macOS you can also use `/usr/libexec/java_home` to locate the JDK.

**Windows:**
1. Search **Edit the system environment variables** → **Environment Variables**
2. Edit **Path** → **New** → add `C:\Program Files\Java\<jdk-version>\bin`
3. Open a **new** terminal and run `jar --version`

A new terminal is required — existing windows keep the old PATH.

---

## Verify

```bash
# Both should print a version string
java -version
jar --version
```

Once `jar --version` prints, the tool is on your PATH and ready.

---

## Summary

| Situation | Fix |
|-----------|-----|
| Don't want to install anything | Use the [JAR Viewer](https://jar.tools/jar-viewer) / [JAR Decompiler](https://jar.tools/jar-decompiler) online |
| `java: command not found` too | No Java installed: install a JDK (`apt install openjdk-21-jdk`, Temurin, `brew install openjdk`) |
| `java` works, `jar` doesn't | Install a **JDK**, not just a JRE |
| JDK installed but `jar` not found | Add the JDK `bin` folder to your `PATH` |
| Windows: not recognized | Add `...\bin` to Path, open a new terminal |

---

> **Skip the CLI — work with JARs online:** [Open the JAR Viewer →](https://jar.tools/jar-viewer)

> **Related:** [How to Create a JAR File](https://jar.tools/kb/how-to-create-jar-file) · [How to Extract a JAR File](https://jar.tools/kb/extract-jar-file) · [How to Run a JAR File](https://jar.tools/kb/run-jar-file)
