JetBrains/intellij-community · error · ExecutionException
No JDK specified
Error message
No JDK specified
What it means
In appendForkInfo, after fork-mode checks pass, the state computes JavaParameters and requires javaParameters.getJdk() to be non-null; when the run configuration resolved to no JDK/Sdk, an ExecutionException('No JDK specified') is thrown and the run stops before any process starts.
Source
Thrown at java/execution/impl/src/com/intellij/execution/JavaTestFrameworkRunnableState.java:479
final String actionName = executor.getActionName();
throw new CantRunException(JavaCompilerBundle.message("action.disabled.when.per.module.working.directory.configured",
actionName));
}
}
else {
return;
}
}
else if (isExecutorDisabledInForkedMode()) {
final String actionName = executor.getActionName();
throw new CantRunException(JavaCompilerBundle.message("action.disabled.in.fork.mode", actionName,
StringUtil.toLowerCase(actionName)));
}
final JavaParameters javaParameters = getJavaParameters();
final Sdk jdk = javaParameters.getJdk();
if (jdk == null) {
throw new ExecutionException(ExecutionBundle.message("run.configuration.error.no.jdk.specified"));
}
try {
final File tempFile = FileUtil.createTempFile("command.line", "", true);
try (PrintWriter writer = new PrintWriter(tempFile, StandardCharsets.UTF_8)) {
ShortenCommandLine shortenCommandLine = getConfiguration().getShortenCommandLine();
boolean useDynamicClasspathForForkMode = shortenCommandLine == null
? JdkUtil.useDynamicClasspath(getConfiguration().getProject())
: shortenCommandLine != ShortenCommandLine.NONE;
if (shortenCommandLine == ShortenCommandLine.ARGS_FILE) {
//see com.intellij.rt.execution.testFrameworks.ForkedByModuleSplitter.startChildFork
writer.println(shortenCommandLine);
}
else if (useDynamicClasspathForForkMode && forkPerModule()) {
writer.println("use classpath jar");
}
else {
writer.println("");View on GitHub (pinned to be881553f2)
Solutions
- Open File | Project Structure | Project (and Modules) and set a valid Project/Module SDK
- If the run configuration specifies an 'Alternative JRE' / JRE path, fix it to an existing JDK installation
- Re-import/refresh the project (Maven/Gradle sync) so SDK references resolve
- Verify the JDK path exists on disk (java -version via that home) — on CI, ensure the JDK is installed and the path matches
Defensive patterns
Strategy: validation
Validate before calling
// verify a JDK resolves before building the command line
Sdk jdk = javaParameters.getJdk();
if (jdk == null || jdk.getHomePath() == null || !new File(jdk.getHomePath()).isDirectory()) {
throw new ConfigurationError("Configure a valid Project/Module SDK");
} Try / catch
try {
state.appendForkInfo(executor);
} catch (ExecutionException e) {
if (ExecutionBundle.message("run.configuration.error.no.jdk.specified").equals(e.getMessage())) {
promptToConfigureSdk();
}
} Prevention
- Keep Project SDK pointing at an existing JDK home; update it after JDK upgrades
- On CI, verify JAVA_HOME / configured SDK path before launching tests
- If using 'Alternative JRE' in a config, validate the path still exists
When it happens
Trigger: JavaParameters produced by the test run configuration have a null JDK: project SDK removed/renamed, module SDK invalid, JRE path pointing to a deleted JDK home, or a runner that never set the JDK (e.g. JPS build not yet run, or dependency resolution failed).
Common situations: SDK defined by path that no longer exists (moved/updated JDK), project SDK set to 'No SDK' after import, module inherited SDK removed, or CI machines lacking the configured JDK. Also when the JdkSelector cannot map the chosen 'Alternative JRE' path.
Related errors
- No JDK specified
- Cannot generate JavaDoc - no javadoc tool found at {0} or {1
- No main class defined
- Home directory is not specified for JDK
- Cannot generate JavaDoc - no Java SDK is configured for the
AI-assisted analysis of JetBrains/intellij-community@be881553f2 (2026-08-14).
Data as JSON: /api/errors/f112b984651ba0e2.
Report an issue: GitHub.