Maven 构建失败:“无法在以下位置找到 Javac 编译器:jre 或 jdk 问题" [英] Maven build failed: "Unable to locate the Javac Compiler in: jre or jdk issue"

查看:26
本文介绍了Maven 构建失败:“无法在以下位置找到 Javac 编译器:jre 或 jdk 问题"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 JAVA_HOME 设置为:

I have my JAVA_HOME set to:

C:Program Files (x86)Javajdk1.6.0_18

运行 maven install 后,我从 日食:

原因:

Unable to locate the Javac Compiler in:
  C:Program Files (x86)Javajre6..lib	ools.jar
Please ensure you are using JDK 1.4 or above and
not a JRE (the com.sun.tools.javac.Main class is required).
In most cases you can change the location of your Java
installation by setting the JAVA_HOME environment variable.

我确定这是棘手的部分

请确保您使用的是 JDK 1.4 或以上和不是 JRE

Please ensure you are using JDK 1.4 or above and not a JRE

当我运行配置时,它被设置为 JRE6.如何将其更改为已安装的 JDK 1.6?

When I run configuration it's set to JRE6. How do I change it to JDK 1.6 which I have already installed?

我什至尝试修改插件:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>2.0.2</version>
    <configuration>
        <source>1.6</source>
        <target>1.6</target>
        <executable>C:Program Files (x86)Javajdk1.6.0_18in</executable>
    </configuration>
</plugin>

我仍然遇到同样的错误.

Still I get the same error.

我使用 Eclipse Maven 插件.如何在 Eclipse 中从 JRE 更改为 JDK?

I use the Eclipse Maven plugin. How can I change from JRE to JDK in Eclipse?

推荐答案

您可以尝试更新Eclipse正在使用的JDK,如下:

You could try updating the JDK Eclipse is using, as follows:

在菜单窗口中添加和设置JRE →首选项...Java已安装的 JRE:

Add and set the JRE in menu WindowPreferences...JavaInstalled JREs:

JRE type: Standard VM JRE
Name: jdk1.6.0_18
JRE home directory: C:Program Files (x86)Javajdk1.6.0_18

如果不是这种情况,则可能是 JAVA_HOME 路径中的括号和空格导致了问题.尝试将您的 JDK 复制到其他位置并更新您的 JAVA_HOME.

If this is not the case, it's possible that the brackets and spaces in the JAVA_HOME path are causing issues. Try copying your JDK to a different location and updating your JAVA_HOME.

这篇关于Maven 构建失败:“无法在以下位置找到 Javac 编译器:jre 或 jdk 问题"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆