title: Missing tools.jar for apt-maven-plugin on Ubuntu Java 8
body: <p>I'm upgrading a maven project to compile with Java 8 from Java 7.</p>
  
  <p>The installed java versions on my machine are</p>
  
  <pre><code>pauloconnell@pauloconnell-HP-ZBook-15:~/$ update-java-alternatives -l
  java-7-oracle 1076 /usr/lib/jvm/java-7-oracle
  java-8-oracle 1077 /usr/lib/jvm/java-8-oracle
  </code></pre>
  
  <p>And my JAVA_HOME is set</p>
  
  <pre><code>pauloconnell@pauloconnell-HP-ZBook-15:~/$ echo $JAVA_HOME
  /usr/lib/jvm/java-8-oracle
  </code></pre>
  
  <p>Any these are the details in my .bashrc file</p>
  
  <pre><code>export JAVA_HOME=/usr/lib/jvm/java-8-oracle
  export MAVEN_HOME=/usr/share/maven/bin
  export PATH=$JAVA_HOME/bin:$MAVEN_HOME/bin
  </code></pre>
  
  <p>When i run 'mvn compile' on a module with this plugin</p>
  
  <pre><code>&lt;plugin&gt;
      &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
      &lt;artifactId&gt;apt-maven-plugin&lt;/artifactId&gt;
      &lt;configuration&gt;
          &lt;factory&gt;com.infonova.om.il.apt.Factory&lt;/factory&gt;
          &lt;showWarnings&gt;true&lt;/showWarnings&gt;
      &lt;/configuration&gt;
      &lt;executions&gt;
          &lt;execution&gt;
              &lt;goals&gt;
                  &lt;goal&gt;process&lt;/goal&gt;
              &lt;/goals&gt;
          &lt;/execution&gt;
      &lt;/executions&gt;
  &lt;/plugin&gt;
  </code></pre>
  
  <p>I get</p>
  
  <pre><code>[ERROR] Failed to execute goal org.codehaus.mojo:apt-maven-plugin:1.0-alpha-5:process (default) on project om-interface-eircom: Unable to locate the apt compiler in:
  [ERROR] /usr/lib/jvm/java-8-oracle/jre/../lib/tools.jar
  [ERROR] Please ensure you are using JDK 1.5 or above and
  [ERROR] not a JRE (the com.sun.tools.apt.Main class is required).
  [ERROR] In most cases you can change the location of your Java
  [ERROR] installation by setting the JAVA_HOME environment variable.
  </code></pre>
  
  <p>I found these existing issues</p>
  
  <pre><code>http://stackoverflow.com/questions/8375423/missing-artifact-com-suntoolsjar
  https://github.com/thickpaddy/jenkins_campfire_plugin/issues/12
  http://stackoverflow.com/questions/10812668/unable-to-locate-the-javac-compiler
  http://stackoverflow.com/questions/5730815/unable-to-locate-tools-jar
  </code></pre>
  
  <p>and updated my plugin config to include the tools as systemPath dependency</p>
  
  <pre><code>&lt;plugin&gt;
      &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
      &lt;artifactId&gt;apt-maven-plugin&lt;/artifactId&gt;
      &lt;configuration&gt;
          &lt;factory&gt;com.infonova.om.il.apt.Factory&lt;/factory&gt;
          &lt;showWarnings&gt;true&lt;/showWarnings&gt;
      &lt;/configuration&gt;
      &lt;executions&gt;
          &lt;execution&gt;
              &lt;goals&gt;
                  &lt;goal&gt;process&lt;/goal&gt;
              &lt;/goals&gt;
          &lt;/execution&gt;
      &lt;/executions&gt;
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.sun&lt;/groupId&gt;
              &lt;artifactId&gt;tools&lt;/artifactId&gt;
              &lt;version&gt;1.8&lt;/version&gt;
              &lt;scope&gt;system&lt;/scope&gt;
              &lt;systemPath&gt;${java.home}/../lib/tools.jar&lt;/systemPath&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  &lt;/plugin&gt;
  </code></pre>
  
  <p>but the problem presists. My maven version details are</p>
  
  <pre><code>pauloconnell@pauloconnell-HP-ZBook-15:~/$ mvn -version
  Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0
  Apache Maven 3.0.5
  Maven home: /usr/share/maven
  Java version: 1.8.0_60, vendor: Oracle Corporation
  Java home: /usr/lib/jvm/java-8-oracle/jre
  Default locale: en_IE, platform encoding: UTF-8
  OS name: "linux", version: "3.13.0-63-generic", arch: "amd64", family: "unix"
  </code></pre>
  
  <p>I believe i jave the correct JAVA_HOME and PATHS set. Any ideas?</p>