skylot/jadx · critical · JadxRuntimeException
Failed to create temp root directory
Error message
Failed to create temp root directory
What it means
Thrown from the static initializer (line 55: tempRootDir = createTempRootDir()) when Files.createTempDirectory(JADX_TMP_INSTANCE_PREFIX) fails. Because this runs at class-load time, the failure manifests as an ExceptionInInitializerError wrapping this JadxRuntimeException. It means the OS default temp directory (java.io.tmpdir, typically /tmp) is not writable or cannot allocate a new directory.
Source
Thrown at jadx-core/src/main/java/jadx/core/utils/files/FileUtils.java:79
public static synchronized Path updateTempRootDir(Path newTempRootDir) {
try {
makeDirs(newTempRootDir);
Path dir = Files.createTempDirectory(newTempRootDir, JADX_TMP_INSTANCE_PREFIX);
tempRootDir = dir;
dir.toFile().deleteOnExit();
return dir;
} catch (Exception e) {
throw new JadxRuntimeException("Failed to update temp root directory", e);
}
}
private static Path createTempRootDir() {
try {
Path dir = Files.createTempDirectory(JADX_TMP_INSTANCE_PREFIX);
dir.toFile().deleteOnExit();
return dir;
} catch (Exception e) {
throw new JadxRuntimeException("Failed to create temp root directory", e);
}
}
public static List<Path> listFiles(Path dir) {
try (Stream<Path> files = Files.list(dir)) {
return files.collect(Collectors.toList());
} catch (IOException e) {
throw new JadxRuntimeException("Failed to list files in directory: " + dir, e);
}
}
public static List<Path> listFiles(Path dir, Predicate<? super Path> filter) {
try (Stream<Path> files = Files.list(dir)) {
return files.filter(filter).collect(Collectors.toList());
} catch (IOException e) {
throw new JadxRuntimeException("Failed to list files in directory: " + dir, e);
}
}View on GitHub (pinned to e738a26571)
Solutions
- Set -Djava.io.tmpdir to a known-writable directory: java -Djava.io.tmpdir=/path/to/writable/dir ...
- Verify /tmp exists, is writable, and has free space/inodes: ls -ld /tmp && df -h /tmp && df -i /tmp.
- If running in a container, mount a writable tmpfs or volume at /tmp.
- Check OS-level security policy (SELinux/AppArmor) is not blocking directory creation.
Example fix
// before — relies on default /tmp which may be unwritable java -jar jadx.jar input.apk // after — point tmpdir to a writable location java -Djava.io.tmpdir=/var/tmp/jadx -jar jadx.jar input.apk
Defensive patterns
Strategy: try-catch
Validate before calling
// Cannot easily validate at runtime since this fires at class-load time.
// Pre-launch check: verify java.io.tmpdir is writable before loading FileUtils.
public static void checkSystemTempDir() {
Path tmp = Path.of(System.getProperty("java.io.tmpdir"));
if (!Files.isDirectory(tmp) || !Files.isWritable(tmp)) {
throw new IllegalStateException("java.io.tmpdir is not writable: " + tmp);
}
} Try / catch
// This fires as ExceptionInInitializerError at class load; catch at the outermost level.
try {
Class.forName("jadx.core.utils.files.FileUtils");
} catch (ExceptionInInitializerError e) {
if (e.getCause() instanceof JadxRuntimeException) {
System.err.println("Fatal: cannot create temp root. Set -Djava.io.tmpdir to a writable dir.");
System.exit(1);
}
} Prevention
- Always set -Djava.io.tmpdir to a known-writable directory in production deployments.
- Verify /tmp is writable and has free space/inodes before launching jadx.
- In containers, mount a writable volume at /tmp or configure tmpdir.
When it happens
Trigger: Loading FileUtils for the first time when java.io.tmpdir is unwritable, does not exist, is full (no inodes), or the process lacks permission. The JVM's -Djava.io.tmpdir was set to an invalid path. This fires at class initialization, so it can crash the entire application before any user code runs.
Common situations: Running jadx in a locked-down container or CI runner where /tmp is mounted read-only or tmpfs is exhausted. Setting -Djava.io.tmpdir to a path that doesn't exist. An inode-exhausted filesystem. SELinux/AppArmor denying directory creation under /tmp.
Related errors
- Failed to create temp directory
- Failed to update temp root directory
- Failed to create temp directory with suffix: ${prefix}
- Can't create directory ${dir}
- Failed to delete directory ${dir}
AI-assisted analysis of skylot/jadx@e738a26571 (2026-08-14).
Data as JSON: /api/errors/4eb51c4d8ba37208.
Report an issue: GitHub.