Not exactly SharePoint, but the issue is when setting the %JAVA_HOME% environment variable, Java installs to the Program Files directory by default. The space in the path seems to stop the variable from being read. You get an error.
Change Program Files to Progra~1, so the path now looks like this:
You can type %JAVA_HOME%\bin\javac to test. Output should look like this: