title: Set Java version on Linux Shell
body: <p>I am running the following script on Linux Centos 7.</p>
  <pre><code>export JAVA_HOME=/usr/lib/jvm/jdk-14.0.2
  echo $JAVA_HOME
  echo | java -version
  echo &quot;maven build ...&quot;
  mvn clean install -DskipTests -Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2
  </code></pre>
  <p>With this output:</p>
  <pre><code>/usr/lib/jvm/jdk-14.0.2
  java version &quot;1.7.0_161&quot;
  OpenJDK Runtime Environment (rhel-2.6.12.0.el7_4-x86_64 u161-b00)
  OpenJDK 64-Bit Server VM (build 24.161-b00, mixed mode)
  maven build ...
  </code></pre>
  <p>As you can see, the java version is <code>1.7.0_161</code>.</p>
  <p><strong>Question</strong></p>
  <p>How do I set the java version to java 14, so that maven builds with java 14?</p>
  <p><strong>More info:</strong></p>
  <p>The java 14 version I installed and I set the <code>JAVA_HOME</code> on is from here: <a href="https://jdk.java.net/14/" rel="nofollow noreferrer">https://jdk.java.net/14/</a> (Linux / x64)</p>
  <p>p.s. I only want to use java 14 for this maven build. I still want to keep Java 1.7 globally.</p>
  <p><strong>UPDATE</strong></p>
  <p><strong>pom.xml</strong></p>
  <pre><code>&lt;properties&gt;
      &lt;java.version&gt;14&lt;/java.version&gt;
      &lt;maven.compiler.source&gt;${java.version}&lt;/maven.compiler.source&gt;
      &lt;maven.compiler.target&gt;${java.version}&lt;/maven.compiler.target&gt;
      &lt;maven.compiler.release&gt;${java.version}&lt;/maven.compiler.release&gt;
      &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
      &lt;jsk.version&gt;2.2.3&lt;/jsk.version&gt;
      &lt;start-class&gt;com.nexct.approvalservice.NexctApprovalServiceApplication&lt;/start-class&gt;
  &lt;/properties&gt;
  
  &lt;build&gt;
      &lt;plugins&gt;
  
          &lt;plugin&gt;
              &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
              &lt;configuration&gt;
                  &lt;source&gt;${java.version}&lt;/source&gt;
                  &lt;target&gt;${java.version}&lt;/target&gt;
                  &lt;fork&gt;true&lt;/fork&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
  </code></pre>