pxb1988/dex2jar · error · IOException

cant find zipfs support

Error message

cant find zipfs support

What it means

Dex2jar writes its output jar via the JDK's NIO zip filesystem provider. createZip scans installed FileSystemProviders for one whose scheme is 'jar' or 'zip'; if none is found it means the JVM's zipfs provider is missing and it throws this IOException instead of returning a FileSystem.

Solutions

  1. Run on a full JDK/JRE 8+ that includes the jdk.zipfs module (standard OpenJDK/Oracle builds include it)
  2. If using jlink, include jdk.zipfs: add it to --add-modules when creating the runtime image
  3. Remove --limit-modules or module restrictions that exclude jdk.zipfs
  4. As a workaround, patch/fork createZip to fall back to java.util.zip ZipOutputStream for writing the output jar

Example fix

// before (jlink image without zipfs)
jlink --add-modules java.base --output minrt
// after
jlink --add-modules java.base,jdk.zipfs --output minrt
Defensive patterns

Strategy: try-catch

Validate before calling

boolean zipfsAvailable = FileSystemProvider.installedProviders().stream()
    .anyMatch(p -> "jar".equals(p.getScheme()) || "zip".equalsIgnoreCase(p.getScheme()));
if (!zipfsAvailable) throw new IllegalStateException("JVM lacks zipfs provider; use a full JDK/JRE with jdk.zipfs");

Try / catch

try {
    dex2jar.to(file);
} catch (IOException e) {
    if (e.getMessage().contains("cant find zipfs support")) {
        // fall back to java.util.zip-based writer or fail with actionable message
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: Calling Dex2jar.to(...) (or any method that invokes createZip) on a JVM where the jdk.zipfs module is not present/enabled, e.g. a stripped custom runtime image (jlink) built without jdk.zipfs.

Common situations: Running dex2jar on a minimal JRE or jlink-trimmed runtime lacking jdk.zipfs; using exotic JVMs (some embedded/Android-art JVMs, very old or non-OpenJDK runtimes) without the NIO zip filesystem provider; module restrictions added via --limit-modules.

Understand the failure class

Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.

Related errors


AI-assisted analysis of pxb1988/dex2jar@b5bda4fb49 (2026-09-08). Data as JSON: /api/errors/e54562da717fb34e. Report an issue: GitHub.

Appendix: source

Thrown at dex-translator/src/main/java/com/googlecode/d2j/dex/Dex2jar.java:304

            }
        }
    }

    private static FileSystem createZip(Path output) throws IOException {
        Map<String, Object> env = new HashMap<>();
        env.put("create", "true");
        Files.deleteIfExists(output);
        Path parent = output.getParent();
        if (parent != null && !Files.exists(parent)) {
            Files.createDirectories(parent);
        }
        for (FileSystemProvider p : FileSystemProvider.installedProviders()) {
            String s = p.getScheme();
            if ("jar".equals(s) || "zip".equalsIgnoreCase(s)) {
                return p.newFileSystem(output, env);
            }
        }
        throw new IOException("cant find zipfs support");
    }

    public Dex2jar withExceptionHandler(DexExceptionHandler exceptionHandler) {
        this.exceptionHandler = exceptionHandler;
        return this;
    }

    public Dex2jar skipExceptions(boolean b) {
        if (b) {
            this.readerConfig |= DexFileReader.SKIP_EXCEPTION;
        } else {
            this.readerConfig &= ~DexFileReader.SKIP_EXCEPTION;
        }
        return this;
    }
}

View on GitHub (pinned to b5bda4fb49)