{"record":{"id":"7abec52a8a6847a1","repo":"JetBrains/intellij-community","slug":"cannot-generate-javadoc-no-java-sdk-is-configure","errorCode":null,"errorMessage":"Cannot generate JavaDoc - no Java SDK is configured for the project. Please specify a Java SDK in Settings | Project Structure.","messagePattern":"Cannot generate JavaDoc - no Java SDK is configured for the project\\. Please specify a Java SDK in Settings \\| Project Structure\\.","errorType":"exception","errorClass":"CantRunException","httpStatus":null,"severity":"error","filePath":"java/java-impl/src/com/intellij/javadoc/JavadocGeneratorRunProfile.java","lineNumber":156,"sourceCode":"            }\n          }\n        }\n      });\n      return handler;\n    }\n\n    private GeneralCommandLine createCommandLine() throws ExecutionException {\n      GeneralCommandLine cmdLine = new GeneralCommandLine();\n      Sdk jdk = getSdk(myProject);\n      setExecutable(jdk, cmdLine);\n      setParameters(jdk, cmdLine);\n      return cmdLine;\n    }\n\n    private void setExecutable(Sdk jdk, GeneralCommandLine cmdLine) throws ExecutionException {\n      String binPath = jdk != null && jdk.getSdkType() instanceof JavaSdkType ? ((JavaSdkType)jdk.getSdkType()).getBinPath(jdk) : null;\n      if (binPath == null) {\n        throw new CantRunException(JavaBundle.message(\"javadoc.generate.no.jdk\"));\n      }\n\n      cmdLine.setWorkDirectory((File)null);\n\n      String toolName = SystemInfo.isWindows ? \"javadoc.exe\" : \"javadoc\";\n      File tool = new File(binPath, toolName);\n      if (!tool.exists()) {\n        tool = new File(new File(binPath).getParent(), toolName);\n        if (!tool.exists()) {\n          File javaHomeBinPath = new File(new File(System.getProperty(\"java.home\")).getParent(), \"bin\");\n          tool = new File(javaHomeBinPath, toolName);\n          if (!tool.exists()) {\n            throw new CantRunException(JavaBundle.message(\"javadoc.generate.no.javadoc.tool\", binPath, javaHomeBinPath));\n          }\n        }\n      }\n      cmdLine.setExePath(tool.getPath());\n","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/JetBrains/intellij-community/blob/be881553f2a76ac8b4ea53950d93f0de78295c19/java/java-impl/src/com/intellij/javadoc/JavadocGeneratorRunProfile.java#L138-L174","documentation":"Before launching javadoc, JavadocGeneratorRunProfile builds the command line: it resolves the project SDK and asks the JavaSdkType for its bin path. If there is no SDK at all, or the SDK is not a JavaSdkType, binPath is null and CantRunException('Cannot generate JavaDoc - no Java SDK is configured...') aborts the run. The message directs the user to Settings | Project Structure because the Tools | Generate JavaDoc action has no JDK to take the javadoc executable from.","triggerScenarios":"Running Tools | Generate JavaDoc in a project with no Project SDK defined, or with a non-Java SDK (e.g. Python/Android-only setup) selected; or the module SDK chain resolves to null.","commonSituations":"Newly imported projects where the SDK was never set; CI-generated projects missing .idea SDK bindings; projects opened after the configured JDK path was deleted or the SDK name became unresolved.","solutions":["Open File | Project Structure | Project and set a valid Project SDK (a full JDK, not a JRE).","Verify the JDK path still exists on disk (invalid paths show red); re-point or re-add the JDK if the installation moved.","For Gradle/Maven projects, ensure the imported JDK resolved (Gradle JVM setting) so the module SDKs are valid, then re-run generation."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Before running javadoc generation:\nSdk sdk = ProjectRootManager.getInstance(project).getProjectSdk();\nif (sdk == null || !(sdk.getSdkType() instanceof JavaSdkType)) {\n  Messages.showWarningDialog(\"Set a Project SDK (full JDK) before generating Javadoc\", \"No JDK\");\n  return;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always configure a valid Project SDK right after importing a project","Verify SDK paths are not red in Project Structure after moving JDKs"],"tags":["javadoc","jdk","project-configuration","ide","sdk"],"backgroundTag":null,"analyzedSha":"be881553f2a76ac8b4ea53950d93f0de78295c19","analyzedAt":"2026-08-14T14:13:06.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}