I\'m new to both Maven and IntelliJ IDEA.
I have a Maven project written in Java 8. Whenever I try to build it (Maven Projects window -> Lifecycle -> compile -> Run
open the ubuntu terminal goto your root directory and type:
export JAVA_HOME =
for example, it works fine for me {do the same in IntelliJ terminal}.
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
to check the set value type echo $JAVA_HOME
to check the maven version type: mvn -version
you can find all path of JDKs by typing this command, and you can set JDK version.
sudo update-alternatives --config java
also check you have same java -version and javac -version.