JetBrains/intellij-community · error · IOException
Was not able to determine JDK for project
Error message
Was not able to determine JDK for project
What it means
Error "Was not able to determine JDK for project " thrown in JetBrains/intellij-community.
Source
Thrown at java/compiler/impl/src/com/intellij/compiler/CompilerManagerImpl.java:476
final Pair<Sdk, JavaSdkVersion> runtime = BuildManager.getJavacRuntimeSdk(myProject);
final Sdk sdk = runtime.getFirst();
final SdkTypeId type = sdk.getSdkType();
String javaHome = null;
if (type instanceof JavaSdkType) {
javaHome = sdk.getHomePath();
if (!isJdkOrJre(javaHome)) {
// this can be a java-dependent SDK, implementing JavaSdkType
// hack, because there is no direct way to obtain the java sdk, this sdk depends on
final String binPath = ((JavaSdkType)type).getBinPath(sdk);
javaHome = binPath != null? new File(binPath).getParent() : null;
if (!isJdkOrJre(javaHome)) {
javaHome = null;
}
}
}
if (javaHome == null) {
throw new IOException("Was not able to determine JDK for project " + myProject.getName());
}
final OutputCollector outputCollector = new OutputCollector();
DiagnosticCollector diagnostic = new DiagnosticCollector();
final Set<File> sourceRoots = FileCollectionFactory.createCanonicalFileSet();
if (!sourcePath.isEmpty()) {
sourceRoots.addAll(sourcePath);
}
else {
for (File file : files) {
final File parentFile = file.getParentFile();
if (parentFile != null) {
sourceRoots.add(parentFile);
}
}
}
final Map<File, Set<File>> outs = Collections.singletonMap(outputDir, sourceRoots);View on GitHub (pinned to be881553f2)
Solutions
- Assign a Project SDK under File | Project Structure | Project Settings | Project.
- If no JDK exists, add one under File | Project Structure | Platform Settings | SDKs, then select it as the project SDK.
Example fix
File | Project Structure | Project -> SDK: choose a configured JDK (e.g. temurin-17).
When it happens
Trigger: Compilation is started while the project has no SDK configured, or the configured JDK was removed or is invalid.
Common situations: Freshly checked-out project without an SDK, a project JDK pointing at a deleted JDK installation, or a project opened before any JDK was registered in the IDE.
AI-assisted analysis of JetBrains/intellij-community@be881553f2 (2026-08-14).
Data as JSON: /api/errors/223b09fe11c29d22.
Report an issue: GitHub.