我已经在已经存在Java的机器上安装了maven。但当我点击任何maven命令时,它告诉Java路径设置不正确。我尝试了很多导出命令但是没有为我做好
日志
[root@sandbox test]# mvn --version
Error: JAVA_HOME is not defined correctly.
We cannot execute /opt/java/jdk1.8.0_131/bin/java/bin/java
[root@sandbox test]# whereis java
java: /usr/bin/java /usr/lib/java /etc/java /usr/share/java /opt/java/jdk1.8.0_131/bin/java
[root@sandbox test]# ls -l /usr/bin/java
lrwxrwxrwx 1 root root 22 Sep 12 2017 /usr/bin/java -> /etc/alternatives/java
[root@sandbox test]# ls -l /etc/alternatives/java
lrwxrwxrwx 1 root root 26 Sep 12 2017 /etc/alternatives/java -> /opt/jdk1.8.0_141/bin/java
任何人都想要更多的输入可以粘贴命令,我会粘贴它的输出。
答案 0 :(得分:1)
您需要将JAVA_HOME
设为/opt/java/jdk1.8.0_131