简体   繁体   English

WIX-MSI:如何从系统中的多个JRE版本(1,8、1.7.0_80、1.7.0_79和1.6.0_45)检查jre 1.7的最高版本-直到1.6

[英]WIX - MSI: How to check highest version of jre 1.7 - till 1.6 from multiple version of JRE (1,8, 1.7.0_80, 1.7.0_79 and 1.6.0_45) in the system

How can I check highest version of 1.7 JRE installed in the system by using WIX? 如何使用WIX检查系统中安装的1.7 JRE的最高版本? 1) My application works for only 1.6 or 1.7 of JRE's. 1)我的应用程序仅适用于JRE的1.6或1.7。 2) So during MSI installation need to find our highest version of 1.7 or 1.6. 2)因此,在安装MSI期间,需要找到我们的1.7或1.6的最高版本。 a) If in the system it has installed 1.8.0_45, 1.7.0_80, 1.7.0_79 and 1.6.0_45. a)如果在系统中已安装1.8.0_45,1.7.0_80,1.7.0_79和1.6.0_45。 In this case I have to find out the 1.7.0_80 and need to get the installed path. 在这种情况下,我必须找出1.7.0_80并需要获取安装路径。

As I know below way we can find out the highest version of the JAVA installed in the system. 据我所知,我们可以找到系统中安装的最高版本的JAVA。

 <Property Id="JRE_64">
        <RegistrySearch Id="JRE_64R" Root="HKLM"    Key="SOFTWARE\JavaSoft\Java Runtime Environment" Name="CurrentVersion"    Type="raw" Win64="yes"  />
  </Property> 

Based on this value checking is it 1.8 of JAVA, then need to get 1.7 基于此值检查是JAVA的1.8,则需要得到1.7

<?if [JRE_64] < 1.6 AND  [JRE_64] >= 1.8 ?> 
        <Property Id="JRE_64_7">
            <RegistrySearch Id="JRE_64R_7" Root="HKLM" Key="SOFTWARE\JavaSoft\Java Runtime Environment" Name="Java7FamilyVersion" Type="raw" Win64="yes"  />
        </Property> 
        <?if ([JRE_64_7]  >= 1.7  AND  [JRE_64_7] < 1.8) ?>
            <Property Id="JRE_64_6">
                <RegistrySearch Id="JRE_64R_6" Root="HKLM" Key="SOFTWARE\JavaSoft\Java Runtime Environment" Name="Java6FamilyVersion" Type="raw" Win64="yes"  />
            </Property> 
        <?endif?>
    <?endif?>

But this if condition is not working for Property value comparison ? 但是如果条件不适用于属性值比较,是否可行 How can I solve it? 我该如何解决? any suggestion please. 任何建议。

try custom action, include a vbs binary try to use wmi object and fetch the properties of Java family 尝试自定义操作,包括一个vbs二进制文件尝试使用wmi对象并获取Java系列的属性

Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")

Set allProds= objWMIService.ExecQuery("SELECT Name,Vendor,Version FROM Win32_Product")

Iterate through the allProds, if name is java check for version 遍历allProds,如果name为java,请检查版本

Sample Response 样品响应

Version=6.0.100 版本= 6.0.100

Vendor=Sun Microsystems, Inc. 供应商= Sun Microsystems,Inc.

Name=Java(TM) 6 Update 10 名称= Java(TM)6更新10

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM