Maven not finding java

1

I'm trying to run maven and it's returning me the following error:

/opt/apache-maven-3.3.3/bin/mvn: 227: exec: /opt/jdk1.7.0_79/bin/java: not found

I checked the paths and they are ok, does anyone know the reason for the problem?

My environment looks like this:

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:‌​/usr/games:/usr/local/games:/opt/java/bin:/opt/maven/bin"
JAVA_HOME="/opt/java"
M2_HOME="/opt/maven"
JAVA_OPTS="-Xms1024m -Xmx1536m -XX:MaxPermSize=200m"
MAVEN_OPTS="-XX:MaxPermSize=300m -Xms500m -Xmx1300m -Dfile.encoding=ISO-8859-1 -Dencoding=ISO-8859-1"
    
asked by anonymous 29.06.2015 / 20:13

1 answer

3

Your JAVA_HOME and your M2_HOME are wrong. Yours are like this:

JAVA_HOME="/opt/java"
M2_HOME="/opt/maven"

They should look like this:

JAVA_HOME="/opt/jdk1.7.0_79"
M2_HOME="/opt/apache-maven-3.3.3"

Your PATH is also wrong. Yours is like this:

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:‌​/usr/games:/usr/local/games:/opt/java/bin:/opt/maven/bin"

It should look like this:

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:‌​/usr/games:/usr/local/games:/opt/jdk1.7.0_79/bin:/opt/apache-maven-3.3.3/bin"
    
29.06.2015 / 20:42