XWIKI-10810: Use JAVA_HOME if the user has set it instead of searching in the registry

Shouldn't this be unindented?

@msmeria  just to be sure, this construct will work on all versions of windows?