title: gradle: java: Cannot find System Java Compiler
body: <p>How can I gradle my hello.java project? Right now I get the error message "Cannot find System Java Compiler". However, for me everything seems fine configured on this Ubuntu 14:</p>
  
  <pre><code>user:~/program/java/src/main/java$ javac hello.java 
  user:~/program/java/src/main/java$ ls
  hello.class  hello.java
  user:~/program/java/src/main/java$ java hello 
  Hello World!
  user:~/program/java/src/main/java$ cd ../../../
  user:~/program/java$ ls
  build  build.gradle  src
  user:~/program/java$ gradle build
  :compileJava FAILED
  
  FAILURE: Build failed with an exception.
  
  * What went wrong:
  Execution failed for task ':compileJava'.
  &gt; Cannot find System Java Compiler. Ensure that you have installed a JDK (not just a JRE) and configured your JAVA_HOME system variable to point to the according directory.
  
  * Try: ...
  
  BUILD FAILED
  </code></pre>
  
  <p>My system configuration:</p>
  
  <pre><code>user:~/program/java$ javac -version
  javac 1.7.0_72
  user:~/program/java$ java -version
  java version "1.7.0_65"
  OpenJDK Runtime Environment (IcedTea 2.5.3) (7u71-2.5.3-0ubuntu0.14.04.1)
  OpenJDK Server VM (build 24.65-b04, mixed mode)
  suser:~/program/java$ echo "$JAVA_HOME"
  /usr/lib/jvm/java-1.7.0-openjdk-i386
  user:~/program/java$ ls -l /etc/alternatives/java
  lrwxrwxrwx 1 root root 41 Jan 10 18:29 /etc/alternatives/java -&gt; /usr/lib/jvm/java-7-openjdk-i386/bin/java
  </code></pre>
  
  <p>JAVA_HOME is defined in /etc/environment (was restarted) and also in the $HOME/.bashrc.</p>
  
  <p>So, I think I did the things mentioned in <a href="https://stackoverflow.com/questions/20715586/ubuntu-cannot-find-system-java-compiler-ensure-that-you-have-installed-a-jdk-n">this post</a>. The hints there are similar to most hints I found googling. </p>
  
  <hr>
  
  <p>Due to Invisible Arrows answer I changed $JAVA_HOME to /usr/lib/jvm/java-7-openjdk-i386</p>
  
  <pre><code>user:~/program/java$ echo "$JAVA_HOME"
  /usr/lib/jvm/java-7-openjdk-i386
  </code></pre>
  
  <p>Still the same error.</p>