• Resolved psbook

    (@psbook)


    Experiencing problems with the standard minify and JavaScript, we opted to install the YUI compressor.

    This command works, displaying the usage (options) info:
    /usr/bin/java -jar /usr/local/lib/yuicompressor-2.4.6.jar

    Java is:

    java version "1.6.0_20"
    OpenJDK Runtime Environment (IcedTea6 1.9.8) (rhel-1.22.1.9.8.el5_6-i386)
    OpenJDK Client VM (build 19.0-b09, mixed mode)

    But in W3TC the minify options say:

    JAVA executable (/usr/bin/java) is not a valid file.

    Any pointers on what might be wrong here? Do we need to install PHP/Java bridge or something?

    Help greatly appreciated! 🙂

Viewing 7 replies - 1 through 7 (of 7 total)
  • In the minifying section there are 2 extra fields when enabling this option:

    Path to JAVA executable:
    Path to JAR file:

    In your case you should use the following settings:

    Path to JAVA executable: /usr/bin/java
    Path to JAR file: /usr/local/lib/yuicompressor-2.4.6.jar

    Then press test if everything is working.

    Thread Starter psbook

    (@psbook)

    Yes. We’ve already done all that but it still doesn’t work.

    Any idea why?

    Plugin Contributor Frederick Townes

    (@fredericktownes)

    Are you sure that your installation works on the command line?

    Here’s what I believe may be happening in your case:

    1. system() or shell_exec() are disabled in your system
    2. open_basedir is configured, and your java binary is not in the path
    3. your apache ghost is configured to run under a different user (suexec), and the Java binary does not have the SETUID flag.

    It can be one, or a combination of the above that make it fail for you.

    I’m having this problem too. No matter what I do I can’t work out how to get YUI compressor to work.

    I installed OpenJDK via yum and have extracted the YUI compressor jar file.

    When I click test W3TC keeps saying:

    JAVA executable (/usr/bin/java) is not a valid file.

    Just like it did for psbook.

    I can run YUI compressor no problem (as root) when I SSH in.

    I also checked that open_basedir wasn’t configured and that apache is running under apache.

    I’m not sure how to check whether system() or shell_exec() are disabled and is it safe to enable those?

    Also, turning PHP safe mode off doesn’t help. I feel like a bashing my head against a wall.

    Does anyone have any advice please?

    Although no JS minify finally works with my slideshow, I just found the/a resolution:

    Copying the full jre directory (with bin and lib included) to a folder inside the wordpress installation (e.g. wp-content) and also place the jar files there enables the possibility to use java. Either doing an open_basedir none nor symlinking the java executable or sth. else worked. It’s somehow a strange issue.

    if you were able to run within wp folder it is probably basedir restriction, I would have checked if open_basedir was really set at none

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Java executable "not valid" for YUI minify in W3TC’ is closed to new replies.