I tried mvn clean install in Intellij. But it raise this error.
mvn -version command works fine in the terminal of intellij.
It worked when I set JAVA_HOME and use command prompt for executing mvn clean install.
JAVA_HOME