How to change Java version for Maven in IntelliJ?

后端 未结 8 2070
情书的邮戳
情书的邮戳 2020-12-05 01:43

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

8条回答
  •  孤街浪徒
    2020-12-05 02:13

    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.

提交回复
热议问题