title: QueryDSL-maven-You need to run build with JDK or have tools.jar on the classpath
body: <p>I have same question like <a href="https://stackoverflow.com/questions/24482259/eclipse-issue-with-maven-build-and-jdk-when-generating-qclasses-in-querydsl">this</a>,and I have tried the two solutions,but none works for me.</p>
  
  <p>I copied the configuration for querydsl from it's <a href="https://github.com/querydsl/querydsl/tree/master/querydsl-jpa" rel="nofollow noreferrer">github</a> page .</p>
  
  <p>So my querydsl maven dependency:</p>
  
  <pre><code>    &lt;dependency&gt;
          &lt;groupId&gt;com.querydsl&lt;/groupId&gt;
          &lt;artifactId&gt;querydsl-jpa&lt;/artifactId&gt;
          &lt;version&gt;4.1.4&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
          &lt;artifactId&gt;slf4j-log4j12&lt;/artifactId&gt;
          &lt;version&gt;1.6.1&lt;/version&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p>And my apt configuration:</p>
  
  <pre><code>        &lt;plugin&gt;
              &lt;groupId&gt;com.mysema.maven&lt;/groupId&gt;
              &lt;artifactId&gt;apt-maven-plugin&lt;/artifactId&gt;
              &lt;version&gt;1.1.3&lt;/version&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;process&lt;/goal&gt;
                      &lt;/goals&gt;
                      &lt;configuration&gt;
                          &lt;outputDirectory&gt;target/generated-sources/java&lt;/outputDirectory&gt;
                          &lt;processor&gt;com.querydsl.apt.jpa.JPAAnnotationProcessor&lt;/processor&gt;
                      &lt;/configuration&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
              &lt;dependencies&gt;
                  &lt;dependency&gt;
                      &lt;groupId&gt;com.querydsl&lt;/groupId&gt;
                      &lt;artifactId&gt;querydsl-apt&lt;/artifactId&gt;
                      &lt;version&gt;4.1.4&lt;/version&gt;
                  &lt;/dependency&gt;
              &lt;/dependencies&gt;
        &lt;/plugin&gt;
  </code></pre>
  
  <p>I also modified eclipse.ini,add follow at first line:</p>
  
  <pre><code>-vm
  D:\Program Files\Java\jdk1.8.0_91\bin\javaw.exe
  </code></pre>
  
  <p>But I till get the same error in eclipse:</p>
  
  <pre><code>You need to run build with JDK or have tools.jar on the classpath.If this occures during eclipse build make sure you run eclipse under JDK as well (com.mysema.maven:apt-maven-plugin:1.1.3:process:default:generate-sources)
  </code></pre>
  
  <p>And when I run <code>mvn genarate-sources</code> in cmd,same error occurs:</p>
  
  <pre><code>[INFO] --- apt-maven-plugin:1.1.3:process (default) 
  [ERROR] execute error
  org.apache.maven.plugin.MojoExecutionException: You need to run build with JDK or have tools.jar on the classpath.If this occures during eclipse build make sure you run eclipse under JDK as well
  </code></pre>
  
  <p>Any one can help me?</p>