コード例 #1
0
  /**
   * Select the JRE to choose. The selection algorithm will try to match based on the order
   * specified in the JNLP file. For example,
   *
   * <p><j2se version="1.3 1.2"/> <j2se version="1.4"/>
   *
   * <p>If a wildcard is used, e.g., 1.2+ or 1.2*, we will try to match on the current running or
   * highest version installed
   *
   * <p>Will match on the platform versions 1.3 1.2 1.4 in that given order
   */
  static ConfigProperties.JREInformation selectJRE(LaunchDesc ld) {
    final JREDesc selectedJREDesc[] = new JREDesc[1];
    final ConfigProperties.JREInformation selectedJRE[] = new ConfigProperties.JREInformation[1];

    // Iterate through all JREDesc's
    ResourcesDesc rdescs = ld.getResources();
    rdescs.visit(
        new ResourceVisitor() {
          public void visitJARDesc(JARDesc jad) {
            /* ignore */
          }

          public void visitPropertyDesc(PropertyDesc prd) {
            /* ignore */
          }

          public void visitPackageDesc(PackageDesc pad) {
            /* ignore */
          }

          public void visitExtensionDesc(ExtensionDesc ed) {
            /* ignore */
          }

          public void visitJREDesc(JREDesc jre) {
            if (selectedJRE[0] == null) {
              handleJREDesc(jre, selectedJRE, selectedJREDesc);
            }
          }
        });
    // Mark the selected JRE in launchDesc
    selectedJREDesc[0].markAsSelected();
    return selectedJRE[0];
  }