【问题标题】:You need to run build with JDK or have tools .Jar您需要使用 JDK 运行构建或拥有工具 .Jar
【发布时间】:2018-03-17 21:15:22
【问题描述】:

in this part of POM.xml, i am getting error在 pom.xml 中出现以下错误:

您需要使用 JDK 运行构建或在类路径上有工具 .Jar...

** 我已经尝试将 JDK 添加为 jre 路径

**还在

中添加了tools.jar

配置构建路径 - 外部库

但是运气不好……

【问题讨论】:

  • 设置JAVA_HOME环境变量为JDK目录,Maven用它来查找JDK
  • 你能在命令行上不带参数运行javac吗?

标签: java xml maven servlets spring-data-jpa


【解决方案1】:

解决方案 1: 尝试C:\Program Files\Java\jdk1.x.x_xx"C:\Program Files\Java\jdk1.x.x_xx\jre 而不是C:\Program Files\Java\jre7

解决方案 2: Editeclipse.ini文件

-vm
C:\jdk1.7\bin\javaw.exe

【讨论】:

  • 已经尝试过编辑eclipse Ini -vm C: -vm C:\jdk1.7\bin\javaw.exe 但没有运气
  • 你用的是eclipse吗?
【解决方案2】:
In Eclipse 
------------

Go to properties --> Java build path -->Add the JDK Don't add the jre.build and check.If not run build path double click the jre system library --> select the Installed JRE -->select edit ----> Add the external jar -->go to the java installed path C:\Program Files\Java\jdk1.8.0_91\lib select tools.jar .Now build it 

**Add the dependency**

<plugin>
  <groupId>com.mysema.maven</groupId>
  <artifactId>apt-maven-plugin</artifactId>
  <version>1.0.6</version>
  <executions>
    <execution> 
      <goals>
        <goal>process</goal>
      </goals>
      <configuration>
        <outputDirectory>target/generated-sources/java</outputDirectory>
        <processor>com.mysema.query.apt.jpa.JPAAnnotationProcessor</processor>
      </configuration>
    </execution>
  </executions>
  <dependencies>
    <dependency>
      <groupId>com.sun</groupId>
      <artifactId>tools</artifactId>
      <version>1.7</version>
      <scope>system</scope>
      <systemPath>${java.home}/../lib/tools.jar</systemPath>
     </dependency>
  </dependencies>
</plugin>

【讨论】:

  • 添加依赖并检查
  • 这不是很好的建议。使用 Maven system 范围依赖被认为是不好的做法,并且该功能可能会在 Maven 的未来版本中消失。 @EvgeniyDorofeev 的建议是要走的路。
猜你喜欢
  • 2015-02-21
  • 2017-06-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-12-03
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多