{"record":{"id":"453fe01c76997a02","repo":"openjdk/jdk","slug":"no-found-in-the-full-path-of-the-executable","errorCode":null,"errorMessage":"no '/' found in the full path of the executable\n","messagePattern":"no '/' found in the full path of the executable\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/java.base/unix/native/launcher/relauncher.c","lineNumber":53,"sourceCode":"#error LAUNCHER_ARGS must be defined\n#endif\n\nstatic char *launcher_args[] = LAUNCHER_ARGS;\n\nint main(int argc, char *argv[]) {\n    ////////////////////////////////////////////////////////////////////////////\n    // Create a fully qualified path to the java executable in the same\n    // directory as this file resides in.\n\n    char *our_full_path = realpath(argv[0], NULL);\n    if (our_full_path == NULL) {\n        perror(\"failed to get the full path of the executable\");\n        return 1;\n    }\n\n    char *last_slash_pos = strrchr(our_full_path, '/');\n    if (last_slash_pos == NULL) {\n        fprintf(stderr, \"no '/' found in the full path of the executable\\n\");\n        return 1;\n    }\n\n    size_t base_length = last_slash_pos - our_full_path + 1;\n    size_t java_path_length = base_length + strlen(JAVA_EXECUTABLE_NAME) + 1;\n\n    char *java_path = malloc(java_path_length);\n    if (java_path == NULL) {\n        perror(\"malloc failed\");\n        return 1;\n    }\n\n    memcpy(java_path, our_full_path, base_length);\n    strcpy(java_path + base_length, JAVA_EXECUTABLE_NAME);\n\n    ////////////////////////////////////////////////////////////////////////////\n    // Build the argument list: our executable name + launcher args + users args\n","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/openjdk/jdk/blob/88dfb74bbeefcf2b0aa11835183bcd949998fc8f/src/java.base/unix/native/launcher/relauncher.c#L35-L71","documentation":"From the Unix java launcher relauncher (the small program that execs the real 'java' binary living next to it, used for the JDK 8->9+ launcher compatibility shim). After realpath(argv[0]) succeeded, strrchr(path, '/') found no slash, so it cannot derive the directory that should contain the real java executable; it prints the message and returns exit code 1.","triggerScenarios":"argv[0] resolves (via realpath) to a path with no '/' component — in practice only possible when the resolved absolute path degenerates (e.g. the program is invoked such that realpath returns a relative name because the executable was deleted/replaced while running, or a container/ptrace environment gives a bogus argv[0]). On POSIX, realpath normally yields an absolute path starting with '/', so this is a defensive almost-unreachable branch.","commonSituations":"Corrupted JDK installation where the relauncher's own binary has been unlinked while executing; unusual exec environments (chroot, containers, LD_PRELOAD path games) producing non-absolute realpath results; a broken symlink chain ending in a bare filename.","solutions":["Verify the JDK installation layout: the relauncher and the 'java' executable must sit in the same bin/ directory","Invoke java via its real path (absolute or a proper PATH entry) rather than exotic argv[0] tricks; avoid replacing/deleting the binary while it runs","Reinstall or re-extract the JDK image if the bin directory is inconsistent (missing java executable next to the relauncher)","If this reproduces in a container, check that the binary is mounted from a normal filesystem and not modified between exec and realpath"],"exampleFix":"# before\n./some-weird-link-to-jdk/bin/java -version   # broken link target\n\n# after\n/path/to/jdk/bin/java -version                 # intact bin directory","handlingStrategy":"validation","validationCode":"# Verify the launcher directory is intact before invoking:\nJH=/path/to/jdk\n[ -x \"$JH/bin/java\" ] && [ -x \"$JH/bin/jexec\" ] 2>/dev/null || echo \"check $JH/bin layout\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Invoke the JDK via its installed path or PATH entry; avoid exec'ing from scripts that rewrite argv[0]","Do not delete or replace the bin directory contents of a running JDK image"],"tags":["jdk","launcher","unix","relauncher","installation"],"backgroundTag":null,"analyzedSha":"88dfb74bbeefcf2b0aa11835183bcd949998fc8f","analyzedAt":"2026-08-14T11:45:09.665Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}