I am trying to create a bundle to install the latest version of the Java JRE. I built a bundle which does three tasks:



1. Uninstalls Java 7 using - wmic product where "name like 'Java 7 Update%'" call uninstall

2. Copy the Java 8 installation files to C:\Patches\Java

3. Launch the installation by calling the executable with INSTALLCFG parameter.



My requirements logic is this:



If Windows version = 6.1 AND

if C:\Program Files (x86)\Java\jre7\bin\java.exe EXISTS (for case where Java 7 is installed)

OR

If Windows version = 6.1 AND

if C:\Program Files (x86)\Java\jre7\bin\java.exe DO NOT EXISTS AND (for case where neither 7 or 8 are installed)

if C:\Program Files (x86)\Java\jre8\bin\java.exe DO NOT EXISTS

OR
If Windows version = 6.1 AND

if C:\Program Files (x86)\Java\jre8\bin\java.exe version >= 8.0 AND

if C:\Program Files (x86)\Java\jre8\bin\java.exe version < 8.0.310.13



The above logic is required as Java 7 or 8 may or may not be installed, or if Java 8 is installed, make sure it is a less current version.



But this is not working. The first command runs fine but the second and third do not, at least not on the first run. If I rerun the bundle a second time the second and third command run fine. It is almost like the logic is being reapplied between the first the second command and failing at the first test. I do not have individual requirements for the second or third steps.



Any suggestions? Thanks a bunch, Chris.