Windows下的Maven安装:“JAVA_HOME设置为无效目录” [英] Maven Installation under Windows: "JAVA_HOME is set to an invalid directory"
本文介绍了Windows下的Maven安装:“JAVA_HOME设置为无效目录”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是Maven的新手,我已经下载了3.0.5版本。我收到以下错误:
I'm new to Maven and I have downloaded the 3.0.5 version. I'm getting the following error:
JAVA_HOME is set to an invalid directory. please set the java_home variable in your environment variable to match the location of your java installation
虽然,我看到了在命令提示符下键入 javac
或echo %M2_HOME%
时没有错误。
Although, I see no error when I type javac
or echo %M2_HOME%
in the command prompt.
我设置了以下路径变量 -
I have the following path variables set -
CLASSPATH - ;C:\Program Files (x86)\Java\jdk1.7.0_40\lib;
JAVA_HOME - C:\Program Files (x86)\Java\jdk1.7.0_40\bin
M2 - %M2_HOME%\bin
M2_HOME - C:\Users\cbil\Documents\Maven\apache-maven-3.0.5-bin\apache-maven-3.0.5
MAVEN_OPTS - -Xms256m -Xmx512m
PATH - C:\Program Files\Java\jdk1.7.0_45\bin;C:\Users\cbil\Documents\Maven\apache-maven-3.0.5-bin\apache-maven-3.0.5\bin;
有人可以帮帮我吗?
推荐答案
-
M2_HOME
指向安装maven的目录。 -
M2
指向maven下的 bin 目录 -
JAVA_HOME
指向系统上安装的JDK目录。 M2_HOME
points to the directory where maven is installed.M2
points to the bin directory under mavenJAVA_HOME
points to the JDK directory installed on your system.
从以下设置再次验证:
JAVA_HOME - C:\Program Files\Java\jdk1.6.0_23
M2_HOME - D:\Software\apache-maven-3.0.5
M2 - %M2_HOME%\bin
PATH - %M2%;%JAVA_HOME%\bin
这篇关于Windows下的Maven安装:“JAVA_HOME设置为无效目录”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文