_JAVA_OPTIONS is a flag specific to Windows. I'd recommend unsetting it personally because if it's not set to something sensible it seems to override other flags. I've often seen it set to specify a maximum of 1 GB of RAM for the Java process, which is not enough to build App Inventor.
Regarding your screenshots, it looks as if your path is set up to not include the path to the actual java and javac processes installed as part of OpenJDK. Instead, it points somewhere else (probably a built-in Windows program) that instead tries to launch an installer for the JRE. In git bash, you should be able to run which java to find out the full path to the Java executable that will be run. If it doesn't point to the java in OpenJDK, update your PATH configuration in System Environment Variables, restart git bash, and try again.
Harish@SRIKAR MINGW64 /e/srikar/Funmora_Builder/appinventor (master)
$ ant
We cannot run Java, please ensure you have Java installed.
We have tried to execute /e/srikar/OpenJDK-8u41/java-se-8u41-ri/bin/bin/java but failed.
If you have installed Java in a unusual place you can set JAVA_HOME
to the directory containing the Java installation.
JAVA_HOME should be set to the root of the java environment, not to the bin directory. Adjust your JAVA_HOME variable accordingly since the lookups are relative to the root, not bin.
P.S: I removed the _JAVA_OPTIONS variable as it caused error with javac -version
Image of the error(javac -version)
Harish@SRIKAR MINGW64 ~
$ javac -version
Error occurred during initialization of VM
Could not reserve enough space for 2097152KB object heap
Picked up _JAVA_OPTIONS: -Xmx2048M
Downloading the java binaries and adding their path to the environment variables instead of using an installer to install it should work if configured correctly.
What about the result of this command?
Your system is picking an incorrect java path. You might want to check you have specified an existing and valid paths to the JAVA_HOME and PATH variables for java.