Correct example taken from Apache webside
Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-17T20:33:14+02:00) Maven home: /opt/apache-maven-3.5.4 Java version: 1.8.0_45, vendor: Oracle Corporation Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre Default locale: en_US, platform encoding: UTF-8 OS name: "mac os x", version: "10.8.5", arch: "x86_64", family: "mac"
An incorrect result I am getting in Command Prompt Windows 10
C:\Users\xxxxx>mvn -v
Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-17T11:33:14-07:00) Maven home: C:\new_software\apache-maven-3.5.4-bin\apache-maven-3.5.4\bin.. Java version: 1.8.0_181, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk1.8.0_181\jre Default locale: en_US, platform encoding: Cp1252 OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
I set up System Variables in Environment Variables
JAVA_HOME C:\Program Files\Java\jdk1.8.0_181
M2_HOME C:\new_software\apache-maven-3.5.4-bin\apache-maven-3.5.4
Added to the Path in System Variables
%JAVA_HOME%\bin
%M2_HOME%\bin
What could be the reason for getting
runtime: C:\Program Files\Java\jdk1.8.0_181\jre
instead
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre
is for Mac-osx and not for windows, I think you might have downloaded mac-osx package of maven. – dkb