Fix for issue 3971 (windows: setup should detect Java automatically)
The fix will improve the user experience in Windows when installing from a ZIP file. When the JVM is installed, the java.exe is contained in the PATH environment variable. The fix consists on trying to see if java.exe is on the PATH by calling java.exe -version if no OPENDS_JAVA_HOME nor JAVA_HOME environment variables are defined..
Note that even though this is an expensive operation in term of resources, this will only be called when the setup is launched for the first time. The setup will update the environment of execution of OpenDS and this call will no longer be made. The exception to this is the case where the user removes all the environment by deleting the files generated by the setup (or dsjavaproperties), this is done usually when the java environment has changed and the user has been told to do so (and also told to call dsjavaproperties). Once dsjavaproperties is called again (the normal procedure to configure the execution environment) this 'extra' call to java.exe will not be made in the scripts.
In other words, the fix will only have a performance penalty when the user calls 'setup' for the first time (and no OPENDS_JAVA_HOME or JAVA_HOME env variables are defined) and when the user resets the execution environment (and so is supposed to call dsjavaproperties). This small penalty (some extra tenths of a second) is acceptable because with the fix in most of the cases the user will not have to set OPENDS_JAVA_HOME (dealing with environment variables is a rare procedure for Windows users). As a result of this the user experience will be much smoother than what is today.