0

I have installed maven on my machine with Java already present. but when i hit any maven command it tells Java path is not set correctly. I tried with a lot of export commands as well but din't worked out for me

Logs

[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

Anybody want more inputs on this can paste the command and i will paste the output for it.

5
  • can you please post what you get when run the command echo $JAVA_HOME Commented Mar 16, 2018 at 7:33
  • /opt/java/jdk1.8.0_131/bin/java Commented Mar 16, 2018 at 7:36
  • You need to export JAVA_HOME and add that to the end of PATH variable Commented Mar 16, 2018 at 7:38
  • askubuntu.com/a/582100 This should help you Commented Mar 16, 2018 at 7:39
  • It's only necessary to set JAVA_HOME correctly to get Maven working. Adding to the PATH is only needed if you like to call Java yourself... Commented Mar 16, 2018 at 7:51

1 Answer 1

1

You need to set JAVA_HOME as /opt/java/jdk1.8.0_131

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.