title: Maven Ant BuildException with maven-antrun-plugin ... unable to find javac compiler
body: <p>I'm trying to make Maven call an ANT build for some legacy code. The ant build builds correctly through ant. However when I call it using the maven ant plugin, it fails with the following error:</p>
  
  <pre><code>[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.6:run      (default) on project CoreServices: An Ant BuildException has occured: The following error occurred while executing this line:
  [ERROR] C:\dev\projects\build\build.xml:158: The following error occurred while executing this line:
  [ERROR] C:\dev\projects\build\build.xml:62: The following error occurred while executing this line:
  [ERROR] C:\dev\projects\build\build.xml:33: The following error occurred while executing this line:
  [ERROR] C:\dev\projects\ods\build.xml:41: Unable to find a javac compiler;
  [ERROR] com.sun.tools.javac.Main is not on the classpath.
  [ERROR] Perhaps JAVA_HOME does not point to the JDK.
  [ERROR] It is currently set to "C:\bea\jdk150_11\jre"
  </code></pre>
  
  <p>My javac exists at C:\bea\jdk150_11\bin and this works for all other things.  Im not sure where Maven is getting this version of JAVA_HOME.  JAVA_HOME in windows environmental variables is set to C:\bea\jdk150_11\ as it should be.  </p>
  
  <p>The Maven code that I'm using to call the build.xml is </p>
  
  <pre><code>&lt;build&gt;
     &lt;plugins&gt;
      &lt;plugin&gt;
       &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
       &lt;artifactId&gt;maven-antrun-plugin&lt;/artifactId&gt;
       &lt;version&gt;1.6&lt;/version&gt;
  
       &lt;executions&gt;
            &lt;execution&gt;
              &lt;phase&gt;install&lt;/phase&gt;
              &lt;configuration&gt;
  
                &lt;target&gt;
      &lt;ant antfile="../build/build.xml" target="deliver" &gt;
      &lt;/ant&gt;
                &lt;/target&gt;
              &lt;/configuration&gt;
              &lt;goals&gt;
                &lt;goal&gt;run&lt;/goal&gt;
              &lt;/goals&gt;
            &lt;/execution&gt;
          &lt;/executions&gt;
      &lt;/plugin&gt;
     &lt;/plugins&gt;
    &lt;/build&gt;
  </code></pre>