即使已设置,Maven也找不到Java [英] Maven not finding Java even though it is set

查看:103
本文介绍了即使已设置,Maven也找不到Java的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以此在墙壁上拍打我的头.使用Mac 10.10和我的java -version可以运行,但是mvn -version可以给我

Beating my head on the wall with this. Using Mac 10.10 and my java -version works but mvn -version gives me

error: JAVA_HOME is not defined correctly. We cannot execute /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/bin/java

那甚至不是我正确的jdk.这是我的bash_profile的样子:export

and that's not even my correct jdk. Here is what my bash_profile looks like:export

export JAVA_HOME=/Library/Java/JavaVirtualMachine/jdk1.8.0_25.jdk/Contents/Home

export M2_HOME=/usr/local/apache-maven/apache-maven-3.2.3
export M2=$M2_HOME/bin
export MAVEN_OPTS=-Xms256m-Xmx512m
export PATH=$M2:$PATH

推荐答案

当我遇到这个问题时.我需要重新启动终端应用程序.为其选择新的bash_profile更改.

When I ran into this. I needed to restart the Terminal app. For it to pick up the new bash_profile changes.

这篇关于即使已设置,Maven也找不到Java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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