How to fix Emulator: Could not spawn java -version in Firebase

FirebaseBEGINNERMEDIUMUpdated Dec 22, 2025· 114 views

The Firebase Emulator Suite runs Firestore and Storage emulators inside a JVM, so starting the suite requires a Java JDK 11+ that the CLI can execute. This error means the CLI failed to spawn `java -version` during initialization, which stops every Java-backed emulator before it can boot.

Quick fix

Fixes Emulator: Could not spawn java -version

java -version
  1. Confirm a compatible Java runtime exists
  2. Install or upgrade to JDK 11 or later
  3. Expose the java binary to the Firebase CLI
  4. Retry the emulator after fixing Java
firebase — error
java -version
Emulator: Could not spawn java -version

What this error means

Starting the Emulator Suite triggers a quick health check that runs `java -version` to confirm a suitable runtime is installed. Firestore, Storage, and the rules runtime are distributed as Java binaries, so if that command can't be spawned (missing binary, broken PATH, or insufficient permissions) the CLI aborts with "Could not spawn java -version" before any emulator starts. The official documentation lists Java JDK 11 or higher as a prerequisite and explains how the JVM options can be customized, so the local environment must expose a compatible java executable before the CLI can download and launch the Java emulators.

Typical symptoms

  • firebase emulators:start exits immediately with "Emulator: Could not spawn java -version" and no emulators boot.
  • Initialization logs stop before Firestore or Storage starts and contain ENOENT / permission denied errors when trying to run java.
  • The CLI keeps retrying java and never progresses to the web UI or any emulator prompts because the Java runtime is unreachable.

Common causes

  1. Java JDK 11+ is not installed or the `java` command is missing entirely.
  2. PATH or JAVA_HOME points to an outdated or non-executable Java install (for example, only a JRE 8 runtime is on PATH).
  3. Security policies, antivirus, or shell wrappers prevent the Firebase CLI from spawning the java binary even though it exists.

How to fix "Emulator: Could not spawn java -version"

1Confirm a compatible Java runtime exists

Run java -version in the same shell where you start the emulator:

bash
java -version

The CLI expects Java 11 or higher (per the emulator docs). If the command prints a version lower than 11, emits an error, or shows "command not found", install or update your JDK before continuing.

2Install or upgrade to JDK 11 or later

If Java is missing or too old, install a supported distribution:

- macOS/Linux: use your package manager (brew install openjdk@11, sudo apt install openjdk-11-jdk, etc.).
- Windows: download a JDK 11+ build from https://jdk.java.net/ or Eclipse Temurin, install it, and follow the installer instructions.

After installing, close and reopen your terminal so the new java binary is visible to the shell.

3Expose the java binary to the Firebase CLI

Ensure PATH (and optionally JAVA_HOME) include the JDK bin directory so the CLI can spawn the java binary. On Linux/macOS run which java and on Windows use where java or PowerShell's Get-Command java. If the command points to the wrong location, update your environment variables (e.g., add export PATH="$JAVA_HOME/bin:$PATH" or add the bin directory to the Windows PATH) and restart the CLI shell. Also verify no wrapper scripts prevent execution or strip the PATH when running firebase emulators:start.

4Retry the emulator after fixing Java

With a working Java runtime, restart the emulator:

bash
firebase emulators:start

It should now proceed past the Java health check, download the emulator JARs, and start the Firestore/Storage services. If you still see Java-related errors, inspect the console output for the actual java command that failed and adjust the PATH or permissions accordingly.

Advanced notes

The Cloud Firestore and Cloud Storage emulators launch JVMs inside the CLI, so environment tweaks that help the JVM (such as JAVA_TOOL_OPTIONS="-Xmx2g") can be applied once the runtime is reachable. When running the suite in CI, export PATH and JAVA_HOME before invoking firebase emulators:start so that non-login shells can spawn java. The CLI only performs the java -version check during startup, so fixing the PATH and rerunning the command usually clears the error permanently.

Frequently asked questions

What does "Emulator: Could not spawn java -version" mean?
Starting the Emulator Suite triggers a quick health check that runs java -version to confirm a suitable runtime is installed. Firestore, Storage, and the rules runtime are distributed as Java binaries, so if that command can't be spawned (missing binary, broken PATH, or insufficient permissions) the CLI aborts with "Could not spawn java -version" before any emulator starts. The official documentation lists Java JDK 11 or higher as a prerequisite and explains how the JVM options can be customized, so the local environment must expose a compatible java executable before the CLI can download and launch the Java emulators.
How do I fix "Emulator: Could not spawn java -version"?
The Firebase Emulator Suite runs Firestore and Storage emulators inside a JVM, so starting the suite requires a Java JDK 11+ that the CLI can execute. This error means the CLI failed to spawn java -version during initialization, which stops every Java-backed emulator before it can boot.
What causes "Emulator: Could not spawn java -version"?
Java JDK 11+ is not installed or the java command is missing entirely. PATH or JAVA_HOME points to an outdated or non-executable Java install (for example, only a JRE 8 runtime is on PATH). Security policies, antivirus, or shell wrappers prevent the Firebase CLI from spawning the java binary even though it exists.
Is the "Emulator: Could not spawn java -version" error serious?
It is a medium-severity error — more of a blocker than a risk. The steps above resolve it.

Official resources & further reading