W3 Total Cache
[resolved] Java executable "not valid" for YUI minify in W3TC (8 posts)

  1. psbook
    Posted 5 years ago #

    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-
    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! :-)

  2. Pascal Dreissen
    Posted 5 years ago #

    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.

  3. psbook
    Posted 5 years ago #

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

    Any idea why?

  4. Frederick Townes
    Plugin Author

    Posted 5 years ago #

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

  5. skaag
    Posted 5 years ago #

    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.

  6. Go Game Guru
    Posted 5 years ago #

    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?

  7. heutger
    Posted 4 years ago #

    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.

  8. natostanco
    Posted 4 years ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • W3 Total Cache
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic