maven build failed:无法找到Javac编译器:jre或jdk问题 [英] maven build failed: Unable to locate the Javac Compiler in: jre or jdk issue
问题描述
C:\程序文件(x86)\Java\jdk1.6.0 _18
运行maven install之后,我从eclipse收到这个消息:
原因:
无法找到Javac编译器:
C:\Program文件(x86)\Java\jre6\..\lib\tools.jar
请确保您使用的是JDK 1.4或更高版本,
不是JRE(com.sun.tools .javac.Main类是必需的)。
在大多数情况下,您可以通过设置JAVA_HOME环境变量来更改Java
安装的位置。
我确信这是棘手的部分
请确保您使用的是JDK 1.4或
,
不是JRE
当我将配置设置为JRE6时,如何将其更改为JDK 1.6,我已经安装了
编辑
我甚至尝试修改插件:
< 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文件(x86)\Java\jdk1.6.0_18\bin< / executable>
< / configuration>
< / plugin>
仍然收到相同的错误
也许我忘了说我使用eclipse maven插件..如何在eclipse中从JRE更改为JDK?
尝试更新JDK Eclipse正在使用,如下所示:
在Window-> Preferences ...-> Java-> Installed JREs中添加并设置JRE:
JRE类型:标准VM JRE
名称:jdk1.6.0_18
JRE主目录:C:\Program文件(x86)\Java\jdk1.6.0_18
如果不是这样,它是可能JAVA_HOME路径中的括号和空格可能导致问题。尝试将JDK复制到其他位置并更新JAVA_HOME。
I have my JAVA_HOME set to
C:\Program Files (x86)\Java\jdk1.6.0_18
After I run maven install I get this message from eclipse:
Reason:
Unable to locate the Javac Compiler in:
C:\Program Files (x86)\Java\jre6\..\lib\tools.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.
I'm certain that this is the tricky part
Please ensure you are using JDK 1.4 or above and not a JRE
When I run configuration its set to JRE6, how do I change it to JDK 1.6 which I have already installed
EDIT
I even tried to modify the plugin :
<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)\Java\jdk1.6.0_18\bin</executable>
</configuration>
</plugin>
Still I get the same error
Maybe I forgot to say I use eclipse maven plugin .. how can I change from JRE to JDK in eclipse ?
You could try updating the JDK Eclipse is using, as follows:
Add and set the JRE in Window->Preferences...->Java->Installed JREs:
JRE type: Standard VM JRE
Name: jdk1.6.0_18
JRE home directory: C:\Program Files (x86)\Java\jdk1.6.0_18
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 build failed:无法找到Javac编译器:jre或jdk问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!