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

I have unindented most of the lines.

I have tested this on my Windows 8.1 and it works as expected. I'm pretty sure it will work for Windows 7 also, but I'll test just in case.