Problem/Motivation

The Google closure compiler JAR file needs to be placed in the module directory, however when calling shell_exec() to run the compiler the JAR path is given relative to the Drupal web root, for example:
java -jar sites/all/modules/contrib/closure_compiler/google_closure_compiler/compiler.jar

This means that locating the JAR file is dependent on the PATH environment variable containing the current working directory '.' for the user account which is running PHP, otherwise the command will fail with a JAR file not found error.

In our case cron was running correctly through drush as the current user, but not when running via Apache.

Proposed resolution

Provide the full path to the JAR file when running the Google closure compiler, for example:
java -jar /var/www/html/sites/all/modules/contrib/closure_compiler/google_closure_compiler/compiler.jar

Comments

markpavlitski’s picture

Issue summary: View changes
markpavlitski’s picture

Status: Active » Needs review
StatusFileSize
new834 bytes

This path ensures the absolute path is used by prefixing it with DRUPAL_ROOT.

markpavlitski’s picture

Issue summary: View changes

  • Commit 700c330 on 7.x-2.x by nburles:
    Issues #2271803 and #2271895 by markpavlitski: Fix bugs detecting java...
nburles’s picture

Status: Needs review » Closed (fixed)

Many thanks for the bug reports... and infinitely more for submitting working patches along with them!

I've tested and committed the fixes, and version 2.3 should become available shortly.