예제 #1
0
 protected boolean supportsWhiteSpaceInEnvVars() {
   final Jvm current = Jvm.current();
   if (getJavaHome().equals(current.getJavaHome())) {
     // we can tell for sure
     return current.getJavaVersion().isJava7Compatible();
   } else {
     // TODO improve lookup by reusing AvailableJavaHomes testfixture
     // for now we play it safe and just return false;
     return false;
   }
 }
예제 #2
0
  /**
   * Locates a JDK installation that is different to the current JVM, ie for which java.home is
   * different.
   *
   * @return null if not found.
   */
  @Nullable
  public static JavaInfo getDifferentJdk() {
    Jvm jvm = Jvm.current();
    for (JvmInstallation candidate : getJvms()) {
      if (candidate.getJavaHome().equals(jvm.getJavaHome())) {
        continue;
      }
      // Currently tests implicitly assume a JDK
      if (!candidate.isJdk()) {
        continue;
      }
      return Jvm.forHome(candidate.getJavaHome());
    }

    return null;
  }