I am new to Ubuntu and Maven. Recently I installed Maven in my system as user and the installation went perfectly, but I can't set path environment variable permanently. I also referred to the following questions but I couldn't solve my problem.
Maven environment variable not working on other terminal
How to permanently set environmental variables PATH and M2_HOME in ubuntu for maven3?
I can set m2_home path in my system as user but when I check if the path is set with mvn -v I get the following error:
Error: JAVA_HOME is not defined correctly. We cannot execute /usr/lib/jvm/jdk1.8.0/bin/java
When I restart the terminal I can't find the path of M2_home. I don't have root access.