Yes, original question is about pure windows, but for those who came here wondering about windows linux subsystem WSL, I stumbled across the thing trying to set up my win WSL, to use windows java Open jdk binaries. Though in a while i gave up on that idea. Installed jdk with 'sudo apt install ...' and then set WSL java home from installed path:
root@mypc://# java -version
openjdk version "1.8.0_265"
OpenJDK Runtime Environment (build 1.8.0_265-8u265-b01-0+deb9u1-b01)
OpenJDK 64-Bit Server VM (build 25.265-b01, mixed mode)
root@mypc://# which java
/usr/bin/java
root@mypc://# realpath /usr/bin/java
/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
use yours realpath instead.
root@mypc://# export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
root@mypc://# mvn -v
Apache Maven 3.6.2 (40f52333136460af0dc0d7232c0dc0bcf0d9e117; 2019-08-27T15:06:16Z)
Maven home: /mnt/c/javaDir/mvn/apache-maven-3.6.2
Java version: 1.8.0_265, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-8-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.4.0-43-microsoft", arch: "amd64", family: "unix"
add export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 to a ~/.bash_profile for this being set every time linux subsystem is lunched.