Title: Java executable &quot;not valid&quot; for YUI minify in W3TC
Last modified: August 20, 2016

---

# Java executable "not valid" for YUI minify in W3TC

 *  Resolved [psbook](https://wordpress.org/support/users/psbook/)
 * (@psbook)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/java-executable-not-valid-for-yui-minify-in-w3tc/)
 * 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)

 *  [Pascal Dreissen](https://wordpress.org/support/users/pdreissen/)
 * (@pdreissen)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/java-executable-not-valid-for-yui-minify-in-w3tc/#post-2165769)
 * 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](https://wordpress.org/support/users/psbook/)
 * (@psbook)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/java-executable-not-valid-for-yui-minify-in-w3tc/#post-2165816)
 * Yes. We’ve already done all that but it still doesn’t work.
 * Any idea why?
 *  Plugin Contributor [Frederick Townes](https://wordpress.org/support/users/fredericktownes/)
 * (@fredericktownes)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/java-executable-not-valid-for-yui-minify-in-w3tc/#post-2166054)
 * Are you sure that your installation works on the command line?
 *  [skaag](https://wordpress.org/support/users/skaag/)
 * (@skaag)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/java-executable-not-valid-for-yui-minify-in-w3tc/#post-2166082)
 * 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.
 *  [Go Game Guru](https://wordpress.org/support/users/gogameguru/)
 * (@gogameguru)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/java-executable-not-valid-for-yui-minify-in-w3tc/#post-2166085)
 * 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?
 *  [heutger](https://wordpress.org/support/users/heutger/)
 * (@heutger)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/java-executable-not-valid-for-yui-minify-in-w3tc/#post-2166102)
 * 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.
 *  [natostanco](https://wordpress.org/support/users/natostanco/)
 * (@natostanco)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/java-executable-not-valid-for-yui-minify-in-w3tc/#post-2166115)
 * 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.

 * ![](https://ps.w.org/w3-total-cache/assets/icon-256x256.png?rev=1041806)
 * [W3 Total Cache](https://wordpress.org/plugins/w3-total-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/w3-total-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/w3-total-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/w3-total-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/w3-total-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/w3-total-cache/reviews/)

 * 7 replies
 * 7 participants
 * Last reply from: [natostanco](https://wordpress.org/support/users/natostanco/)
 * Last activity: [14 years, 2 months ago](https://wordpress.org/support/topic/java-executable-not-valid-for-yui-minify-in-w3tc/#post-2166115)
 * Status: resolved