I installed java and set path to environment and when I execute echo $JAVA_HOME I get the following output:
/usr/lib/jvm/java-7-oracle/jre/bin/j
Firstly, in a development mode, you should use JDK instead of the JRE. Secondly, the JAVA_HOME is where you install Java and where all the others frameworks will search for what they need (JRE,javac,...)
So if you set
JAVA_HOME=/usr/lib/jvm/java-7-oracle/jre/bin/java
when you run a "mvn" command, Maven will try to access to the java by adding /bin/java, thinking that the JAVA_HOME is in the root directory of Java installation.
But setting
JAVA_HOME=/usr/lib/jvm/java-7-oracle/
Maven will access add bin/java then it will work just fine.