Cannot run program “”C:\PROGS\java\Oracle\jdk-8″\bin\java” : CreateProcess error=5, Access is denied

Summary

Maven failed to launch the JDK executable because Windows returned Access is denied (error 5) when the weblogic-appc-maven-plugin tried to start java.exe. The root cause was an incorrect quoting/escaping of the JDK path combined with restrictive ACLs on the directory, causing the process creation to fail even though the binary can be run manually.

Root Cause

  • The plugin builds the command string as

    "\"C:\\PROGS\\java\\Oracle\\jdk-8\"\\bin\\java"

    which results in a double‑quoted path that Windows cannot resolve.

  • Windows treats the outer quotes as part of the executable name, so CreateProcess cannot locate the file.

  • The directory C:\PROGS\java\Oracle\jdk-8 had inherited ACLs that deny execute permission for the user under which Maven runs (typically a service account), triggering error 5.

Why This Happens in Real Systems

  • Path quoting bugs are common when build tools concatenate user‑supplied paths without normalising them.
  • Enterprise environments often enforce strict folder permissions; a tool that works from a console (where you run as an admin) may fail when Maven runs under a less‑privileged account.
  • Plugin developers sometimes hard‑code command‑line construction for a specific OS, overlooking edge cases like spaces or trailing quotes.

Real-World Impact

  • Build pipelines stallmvn clean install aborts, blocking CI/CD.
  • False security alarms – Teams may think the JDK is corrupted or that Windows is blocking Java.
  • Downstream delays – Other modules depending on the plugin cannot be packaged, causing release postponements.

Example or Code (if necessary and relevant)


    weblogic
    weblogic-appc-maven-plugin
    12.2.1-0-0
    
        C:\PROGS\java\Oracle\jdk-8
    

How Senior Engineers Fix It

  • Normalize the JDK path before passing it to the plugin (remove outer quotes, use Path APIs).
  • Update the plugin to the latest version where the quoting bug is fixed, or fork it and patch the command builder.
  • Adjust folder ACLs: grant Read & Execute to the service account running Maven.
  • Add a pre‑build sanity check that attempts to launch java -version using the same environment Maven will use; fail fast with a clear error message.
  • Document the required directory permissions in the project’s README.

Why Juniors Miss It

  • They assume “Java works, so the JDK must be fine” and ignore the context in which Maven runs.
  • Lack of experience with Windows CreateProcess semantics and how quoting affects executable resolution.
  • Tend to focus on application code rather than the build tooling and OS‑level permission models.

Leave a Comment