title: How does maven find Java compiler?
body: <p>I am new to learn maven by following this example given by sonatype's book.This is a simplest <strong>pom.xml</strong> file (works fine). But my question is, how does maven (mvn install) find Java compiler (javac) installed on my machine? This POM file doesn't specify JDK in any way. Thanks for explanation.</p>
  
  <p><strong>EDIT:</strong>
  As a comparison, I am following next example in the book and this time, I received a compilation error because it can't find javax.My java file is in, as suggested in the book: <code>src/main/java/org/sonatype/mavenbook/web/SimpleServlet.java</code> </p>
  
  <p>Now as I run mvn compile, and i got error message below. Why now maven can't find the compiler:</p>
  
  <pre><code>ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project simple-webapp: Compilation failure: Compilation failure:
  [ERROR] /home/abigail/study/simple-webapp/src/main/java/org/sonatype/mavenbook/web/SimpleServlet.java:[4,1] package javax.servlet does not exist
  </code></pre>
  
  <p><strong>POM.xml</strong></p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
                           http://maven.apache.org/maven-    v4_0_0.xsd"&gt;
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  &lt;groupId&gt;org.sonatype.mavenbook.simpleweb&lt;/groupId&gt;
  &lt;artifactId&gt;simple-webapp&lt;/artifactId&gt;
  &lt;packaging&gt;war&lt;/packaging&gt;
  &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
  &lt;name&gt;simple-webapp Maven Webapp&lt;/name&gt;
  &lt;url&gt;http://maven.apache.org&lt;/url&gt;
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;junit&lt;/groupId&gt;
          &lt;artifactId&gt;junit&lt;/artifactId&gt;
          &lt;version&gt;3.8.1&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  &lt;build&gt;
      &lt;finalName&gt;simple-webapp&lt;/finalName&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
              &lt;configuration&gt;
                  &lt;source&gt;1.7&lt;/source&gt;
                  &lt;target&gt;1.7&lt;/target&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>