Languages
[Edit]
EN

Maven / mvn - change used java version

6 points
Created by:
Tyreese-Aguirre
349

In this short article we would like to show how to change Java version used by Maven to other one.

Solution: change JAVA_HOME variable value to proper Java path.

Practical example

The example shows how to change JAVA_HOME system variable value under Windows 10.

1. Before change:

$ mvn -v
Apache Maven 3.6.2 (40f52333136460af0dc0d7232c0dc0bcf0d9e117; 2019-08-27T17:06:16+02:00)
Maven home: C:\Program Files\apache-maven-3.6.2
Java version: 11.0.2, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk-11.0.2
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

2. Setting new JAVA_HOME system variable value:

JAVA_HOME system variable value under Windows 10.
JAVA_HOME system variable value under Windows 10.

3. Terminal re-run or operating system restart.

4. After change:

$ mvn -v
Apache Maven 3.6.2 (40f52333136460af0dc0d7232c0dc0bcf0d9e117; 2019-08-27T17:06:16+02:00)
Maven home: C:\Program Files\apache-maven-3.6.2
Java version: 1.8.0_201, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk1.8.0_201\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

Now Java 1.8 is used with mvn.

Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

Maven

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join