maven 修改java home,Windows下的Maven安装:“JAVA_HOME设置为无效目录”

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

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;

Can someone please help me?

解决方案

M2_HOME points to the directory where maven is installed.

M2 points to the bin directory under maven

JAVA_HOME points to the JDK directory installed on your system.

validate it again from below settings:

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值