skylot/jadx · critical · RuntimeException

Failed to create temp directory

Error message

Failed to create temp directory

What it means

Thrown from the static initialiser of TempFilesGetter.TempRootHolder when Files.createTempDirectory("jadx-temp-") fails (IOException). Because it is thrown from a class-init block, it surfaces to the caller as ExceptionInInitializerError (a linkage error) the first time any TempFilesGetter path is touched. It means jadx could not allocate its working directory under java.io.tmpdir.

Source

Thrown at jadx-core/src/main/java/jadx/core/plugins/files/TempFilesGetter.java:20

import java.nio.file.Files;
import java.nio.file.Path;

import jadx.core.utils.files.FileUtils;

public class TempFilesGetter implements IJadxFilesGetter {

	public static final TempFilesGetter INSTANCE = new TempFilesGetter();

	private static final class TempRootHolder {
		public static final Path TEMP_ROOT_DIR;

		static {
			try {
				TEMP_ROOT_DIR = Files.createTempDirectory("jadx-temp-");
				TEMP_ROOT_DIR.toFile().deleteOnExit();
			} catch (Exception e) {
				throw new RuntimeException("Failed to create temp directory", e);
			}
		}
	}

	private TempFilesGetter() {
	}

	@Override
	public Path getConfigDir() {
		return makeSubDir("config");
	}

	@Override
	public Path getCacheDir() {
		return makeSubDir("cache");
	}

	@Override

View on GitHub (pinned to e738a26571)

Solutions

  1. Point the JVM at a writable temp dir: -Djava.io.tmpdir=/path/to/writable/dir.
  2. Free space on, and check permissions of, the current java.io.tmpdir.
  3. For containers, mount a writable /tmp (e.g. docker run with a tmpfs or a writable volume).
  4. Verify the user running jadx has create/write permission on the temp dir.

Example fix

# before
java -jar jadx-cli.jar app.apk
# after - use a writable tmp dir
mkdir -p /var/tmp/jadx && java -Djava.io.tmpdir=/var/tmp/jadx -jar jadx-cli.jar app.apk
Defensive patterns

Strategy: validation

Validate before calling

// ensure a writable temp dir before touching jadx
Path tmp = Paths.get(System.getProperty("java.io.tmpdir"));
if (!Files.isWritable(tmp)) {
    Path alt = Paths.get(System.getProperty("user.home"), ".jadx-tmp");
    Files.createDirectories(alt);
    System.setProperty("java.io.tmpdir", alt.toString());
}

Try / catch

// ExceptionInInitializerError from a static block cannot be caught at the call site
// in the usual way - pre-validate java.io.tmpdir instead, as shown in validationCode.

Prevention

When it happens

Trigger: Starting jadx (CLI, GUI, or as a library) in an environment where the system temp dir is not writable, does not exist, is full, or where the JVM lacks permission to create directories. The failure happens once, at first use of any jadx file/dir API.

Common situations: Read-only filesystems, containers with an unmounted /tmp, low disk on the temp partition, SELinux/AppArmor denying directory creation, or a -Djava.io.tmpdir pointing at a non-existent or read-only path.

Related errors


AI-assisted analysis of skylot/jadx@e738a26571 (2026-08-14). Data as JSON: /api/errors/fcf7879c8b4a1e86. Report an issue: GitHub.