oracle/graal · error · IllegalStateException

Cannot find 'include' folder in JDK.

Error message

Cannot find 'include' folder in JDK.

What it means

Error "Cannot find 'include' folder in JDK." thrown in oracle/graal.

Source

Thrown at sdk/src/org.graalvm.jniutils/src/org/graalvm/jniutils/JNI.java:1121

        }

        @Override
        public List<String> getHeaderFiles() {
            return Arrays.stream(findJNIHeaders()).map((p) -> '<' + p.toString() + '>').collect(Collectors.toList());
        }

        private static Path[] findJNIHeaders() {
            Path javaHome = Paths.get(System.getProperty("java.home"));
            Path includeFolder = javaHome.resolve("include");
            if (!Files.exists(includeFolder)) {
                Path parent = javaHome.getParent();
                if (parent != null) {
                    javaHome = parent;
                }
            }
            includeFolder = javaHome.resolve("include");
            if (!Files.exists(includeFolder)) {
                throw new IllegalStateException("Cannot find 'include' folder in JDK.");
            }
            Path[] res = new Path[INCLUDES.length];
            try {
                for (int i = 0; i < INCLUDES.length; i++) {
                    String include = INCLUDES[i];
                    Optional<Path> includeFile = Files.find(includeFolder, 2, (p, attrs) -> include.equals(p.getFileName().toString())).findFirst();
                    if (!includeFile.isPresent()) {
                        throw new IllegalStateException("Include: " + res[i] + " does not exist.");
                    }
                    res[i] = includeFile.get();
                }
                return res;
            } catch (IOException ioe) {
                throw new RuntimeException(ioe);
            }
        }
    }
}

View on GitHub (pinned to a66e9ccd1d)

Solutions

  1. Fix the condition reported by the error: Cannot find 'include' folder in JDK.
  2. Check the throwing call site and ensure its documented preconditions (argument values, types, environment, or configuration) are satisfied before the call.

Example fix

Validate inputs and environment so that the failing condition does not occur: Cannot find 'include' folder in JDK.

When it happens

Trigger: Thrown at sdk/src/org.graalvm.jniutils/src/org/graalvm/jniutils/JNI.java:1121 when the library encounters an invalid state.

Common situations: Occurs when a caller violates the contract guarded by this check: Cannot find 'include' folder in JDK.


AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14). Data as JSON: /api/errors/4fb6176a06fdbae4. Report an issue: GitHub.