{"record":{"id":"acbdb56e7a8e7b92","repo":"openjdk/jdk","slug":"createprocess-failed-lu","errorCode":null,"errorMessage":"CreateProcess failed: %lu\n","messagePattern":"CreateProcess failed: %lu\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/java.base/windows/native/launcher/relauncher.c","lineNumber":228,"sourceCode":"    // Finally execute the real java process with the constructed arguments\n\n    if (GetEnvironmentVariable(\"_JAVA_LAUNCHER_DEBUG\", NULL, 0)) {\n        char *program_name = PathFindFileName(argv[0]);\n\n        fprintf(stderr, \"%s: executing: '%s' '%s'\\n\", program_name, java_path, command_line);\n    }\n\n    STARTUPINFO si;\n    PROCESS_INFORMATION pi;\n\n    memset(&si, 0, sizeof(si));\n    si.cb = sizeof(si);\n    memset(&pi, 0, sizeof(pi));\n\n    // Windows has no equivalent of exec, so start the process and wait for it\n    // to finish, to be able to return the same exit code\n    if (!CreateProcess(java_path, command_line, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) {\n        fprintf(stderr, \"CreateProcess failed: %lu\\n\", GetLastError());\n        return 1;\n    }\n\n    if (WaitForSingleObject(pi.hProcess, INFINITE) == WAIT_FAILED) {\n        fprintf(stderr, \"WaitForSingleObject failed: %lu\\n\", GetLastError());\n        return 1;\n    }\n\n    DWORD exit_code;\n    if (!GetExitCodeProcess(pi.hProcess, &exit_code)) {\n        fprintf(stderr, \"GetExitCodeProcess failed: %lu\\n\", GetLastError());\n        return 1;\n    }\n    CloseHandle(pi.hProcess);\n    CloseHandle(pi.hThread);\n\n    return exit_code;\n}","sourceCodeStart":210,"sourceCodeEnd":246,"githubUrl":"https://github.com/openjdk/jdk/blob/88dfb74bbeefcf2b0aa11835183bcd949998fc8f/src/java.base/windows/native/launcher/relauncher.c#L210-L246","documentation":"Windows launcher relauncher: the attempt to start the real 'java' process with CreateProcess(java_path, command_line, ...) failed (returned FALSE). Since Windows has no exec(), the relauncher must spawn java.exe and wait for it; failing here means java was never started. The message prints GetLastError() and the relauncher returns 1.","triggerScenarios":"java_path (the 'java' executable expected in the same directory as the relauncher) does not exist or is not executable; the command line exceeds the 32767-character limit; the image is locked/corrupted (antivirus quarantine); insufficient permissions; or a bogus java.dll sibling blocking image load.","commonSituations":"JDK image with bin\\java.exe deleted or quarantined; running from a read-only/network share with execute denied; extremely long CLASSPATH/options overflowing the command line; partial/corrupted JDK extraction.","solutions":["Confirm bin\\java.exe exists next to the failing executable and can be run directly","Decode the GetLastError() value shown in the message (e.g. 2 = ERROR_FILE_NOT_FOUND, 5 = ERROR_ACCESS_DENIED, 206 = filename/length limits) and address that specific cause","Shorten the command line (use @argfiles, CLASSPATH env, or the JAVA_TOOL_OPTIONS file mechanism) if it is very long","Reinstall/verify the JDK image hashes if the executable seems present but still fails (corruption or AV interference)"],"exampleFix":"# before\nset CLASSPATH=<10k of jars...>\njdk\\bin\\java ... Main\n\n# after\njdk\\bin\\java @options.txt Main   # args moved to an @argfile, short command line","handlingStrategy":"validation","validationCode":"# Verify the real launcher exists next to the relauncher and the cmdline is sane:\nif not exist \"%JH%\\\\bin\\\\java.exe\" echo missing %JH%\\\\bin\\\\java.exe & exit /b 1\njava -XX:+PrintFlagsFinal -version >nul || echo launcher smoke test failed","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep @argfiles for long option/classpath sets so CreateProcess never hits length limits","Exempt the JDK directory from antivirus quarantine, or restore quarantined java.exe and re-verify the image"],"tags":["jdk","launcher","windows","createprocess","installation"],"backgroundTag":null,"analyzedSha":"88dfb74bbeefcf2b0aa11835183bcd949998fc8f","analyzedAt":"2026-08-14T11:45:09.665Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}