Search in sources :

Example 1 with Jvm

use of org.gradle.internal.jvm.Jvm in project gradle by gradle.

the class AvailableJavaHomes method getBestJre.

/**
 * Locates a JRE installation for the current JVM. Prefers a stand-alone JRE installation over one that is part of a JDK install.
 *
 * @return The JRE home directory, or null if not found
 */
public static File getBestJre() {
    Jvm jvm = Jvm.current();
    File jre = jvm.getStandaloneJre();
    if (jre != null) {
        return jre;
    }
    jre = jvm.getEmbeddedJre();
    if (jre != null) {
        return jre;
    }
    // Use the JDK instead
    return jvm.getJavaHome();
}
Also used : Jvm(org.gradle.internal.jvm.Jvm) File(java.io.File)

Example 2 with Jvm

use of org.gradle.internal.jvm.Jvm in project gradle by gradle.

the class NoDaemonGradleExecuter method getImplicitBuildJvmArgs.

@Override
protected List<String> getImplicitBuildJvmArgs() {
    List<String> buildJvmOptions = super.getImplicitBuildJvmArgs();
    final Jvm current = Jvm.current();
    if (getJavaHome().equals(current.getJavaHome()) && JavaVersion.current().isJava9Compatible() && !isUseDaemon()) {
        buildJvmOptions.addAll(JpmsConfiguration.GRADLE_DAEMON_JPMS_ARGS);
    }
    return buildJvmOptions;
}
Also used : Jvm(org.gradle.internal.jvm.Jvm)

Aggregations

Jvm (org.gradle.internal.jvm.Jvm)2 File (java.io.File)1