pxb1988/dex2jar · error · IOException
cant find zipfs support
Error message
cant find zipfs support
What it means
createZip opens a writable NIO FileSystem over the output jar/zip by looking for an installed FileSystemProvider with scheme 'jar' or 'zip'. If no such provider is registered in this JVM, it throws this IOException instead of creating the archive. The JDK only provides zipfs via the jdk.zipfs module, so this means the runtime lacks that module.
Solutions
- Run on a full JDK/JRE that includes the jdk.zipfs module (standard OpenJDK builds have it)
- If using jlink, rebuild the image with --add-modules jdk.zipfs
- Verify with: java --list-modules | grep zipfs, and check providers via FileSystemProvider.installedProviders()
- As a workaround, write the zip with java.util.zip.ZipOutputStream instead of the zipfs FileSystem API
Example fix
// jlink command without zipfs jlink --add-modules java.base --output minimal-jre // after jlink --add-modules java.base,jdk.zipfs --output minimal-jre
Defensive patterns
Strategy: fallback
Validate before calling
boolean zipfsSupported() {
for (FileSystemProvider p : FileSystemProvider.installedProviders()) {
String s = p.getScheme();
if ("jar".equals(s) || "zip".equalsIgnoreCase(s)) return true;
}
return false;
} Try / catch
try (FileSystem fs = BaseCmd.createZip(out)) { /* write entries */ }
catch (IOException e) {
if (e.getMessage().contains("zipfs support")) {
// fall back to ZipOutputStream-based writer
} else throw e;
} Prevention
- Ship/run dex2jar on a full JDK that includes jdk.zipfs
- When building jlink images, always add --add-modules jdk.zipfs
- Smoke-test FileSystemProvider.installedProviders() in your deployment environment before batch jobs
- Prefer standard OpenJDK distributions over trimmed/custom runtimes for conversion tooling
When it happens
Trigger: Calling BaseCmd.createZip(Path) (directly or via dex2jar tools that write a jar) on a JVM without zip filesystem support - e.g. a jlink-custom runtime built without jdk.zipfs, an embedded/reduced JRE, or certain limited JVMs like older/alternative runtimes.
Common situations: Running dex2jar on a minimal container image built with jlink that omitted jdk.zipfs; using a stripped JVM inside an Android/embedded toolchain; running with a non-OpenJDK runtime that does not ship the jar FileSystemProvider.
Understand the failure class
Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.
Related errors
- cant find zipfs support
- Error reading data for near offset
- Size mismatch on inflated file: vs
- Invalid array type
- stack not balanced
AI-assisted analysis of pxb1988/dex2jar@b5bda4fb49 (2026-09-08).
Data as JSON: /api/errors/5749a09e94a413f1.
Report an issue: GitHub.
Appendix: source
Thrown at d2j-base-cmd/src/main/java/com/googlecode/dex2jar/tools/BaseCmd.java:92
if (parent != null && !Files.exists(parent)) {
Files.createDirectories(parent);
}
}
public static FileSystem createZip(Path output) throws IOException {
Map<String, Object> env = new HashMap<>();
env.put("create", "true");
Files.deleteIfExists(output);
createParentDirectories(output);
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 static FileSystem openZip(Path in) throws IOException {
for (FileSystemProvider p : FileSystemProvider.installedProviders()) {
String s = p.getScheme();
if ("jar".equals(s) || "zip".equalsIgnoreCase(s)) {
return p.newFileSystem(in, new HashMap<String, Object>());
}
}
throw new IOException("cant find zipfs support");
}
protected static class HelpException extends RuntimeException {
private static final long serialVersionUID = 5538069795297477488L;
public HelpException() {
super();View on GitHub (pinned to b5bda4fb49)