Question Details

No question body available.

Tags

java java-platform-module-system jdeps

Answers (1)

July 23, 2026 Score: -1 Rep: 1 Quality: Low Completeness: 80%

Error: Module xxx.yyy not found, required by x.y.z indicates that --print-module-deps is the wrong mode for this query. That option prints the module set for tools such as jlink, and the module-dependency options perform transitive analysis by default after JDK-8213915.

For “which platform modules does xyz.jar directly use?”, use non-recursive dependency listing and filter the result. The java. modules are the standard modules; the jdk. modules are JDK-specific modules, per JEP 261.

From the command line:

jdeps --list-deps --no-recursive --ignore-missing-deps xyz.jar \
  | sed -nE 's/^[[:space:]]((java|jdk)\..)$/\1/p'

From Java code, run the same jdeps tool and parse stdout:

import java.io.PrintWriter;
import java.io.StringWriter;
import java.nio.file.Path;
import java.util.List;
import java.util.spi.ToolProvider;
import java.util.stream.Collectors;

Path jar = Path.of("xyz.jar");

ToolProvider jdeps = ToolProvider.findFirst("jdeps") .orElseThrow(() -> new IllegalStateException("jdeps is not available"));

StringWriter out = new StringWriter(); StringWriter err = new StringWriter();

int rc = jdeps.run(new PrintWriter(out), new PrintWriter(err), "--list-deps", "--no-recursive", "--ignore-missing-deps", jar.toString());

if (rc != 0) { throw new IllegalStateException(err.toString()); }

List jdkModules = out.toString().lines() .map(String::trim) .filter(s -> s.startsWith("java.") || s.startsWith("jdk.")) .collect(Collectors.toList());

This provides the direct JDK/system-module dependencies visible from xyz.jar. For the complete transitive module closure through third-party modules, make those third-party modules observable with --module-path; --ignore-missing-deps cannot invent their descriptors.