// Path: src/com/thoughtworks/calabash/android/Environment.java
// public static final String ENV_ANDROID_HOME = "ANDROID_HOME";
// 
// Path: src/com/thoughtworks/calabash/android/Environment.java
// public static final String ENV_JAVA_HOME = "JAVA_HOME";


import java.io.File;
import static com.thoughtworks.calabash.android.Environment.ENV_ANDROID_HOME;
import static com.thoughtworks.calabash.android.Environment.ENV_JAVA_HOME;

    private static String findJavaHome(AndroidConfiguration configuration) throws CalabashException {
        String javaHomeFromConfig = configuration.getJavaHome();
        if (isNotEmpty(javaHomeFromConfig)) {
            CalabashLogger.info(String.format("%s = %s from configuration", ENV_JAVA_HOME, javaHomeFromConfig));
            return javaHomeFromConfig;
        }
        String javaHomeFromSystemProp = System.getProperty(PROPERTY_JAVA_HOME);

        if (isNotEmpty(javaHomeFromSystemProp)) {

            CalabashLogger.info(String.format("%s = %s from system property", PROPERTY_JAVA_HOME, javaHomeFromSystemProp));
            return javaHomeFromSystemProp;
        }

        String javaHomeFromEnv = System.getenv(ENV_JAVA_HOME);
        if (isNotEmpty(javaHomeFromEnv)) {

            CalabashLogger.info(String.format("%s = %s from environment variable", ENV_JAVA_HOME, javaHomeFromEnv));
            return javaHomeFromEnv;
        }
        return null;
    }

    private static String findAndroidHome(AndroidConfiguration configuration) throws CalabashException {
        String androidHome = null;

        String androidHomeFromConfig = configuration.getAndroidHome();
        if (isNotEmpty(androidHomeFromConfig)) {
            androidHome = androidHomeFromConfig;
// Path: src/com/thoughtworks/calabash/android/Environment.java
// public static final String ENV_ANDROID_HOME = "ANDROID_HOME";
// 
// Path: src/com/thoughtworks/calabash/android/Environment.java
// public static final String ENV_JAVA_HOME = "JAVA_HOME";


// Path: src/com/thoughtworks/calabash/android/EnvironmentInitializer.java
import java.io.File;
import static com.thoughtworks.calabash.android.Environment.ENV_ANDROID_HOME;
import static com.thoughtworks.calabash.android.Environment.ENV_JAVA_HOME;


    private static String findJavaHome(AndroidConfiguration configuration) throws CalabashException {
        String javaHomeFromConfig = configuration.getJavaHome();
        if (isNotEmpty(javaHomeFromConfig)) {
            CalabashLogger.info(String.format("%s = %s from configuration", ENV_JAVA_HOME, javaHomeFromConfig));
            return javaHomeFromConfig;
        }
        String javaHomeFromSystemProp = System.getProperty(PROPERTY_JAVA_HOME);

        if (isNotEmpty(javaHomeFromSystemProp)) {

            CalabashLogger.info(String.format("%s = %s from system property", PROPERTY_JAVA_HOME, javaHomeFromSystemProp));
            return javaHomeFromSystemProp;
        }

        String javaHomeFromEnv = System.getenv(ENV_JAVA_HOME);
        if (isNotEmpty(javaHomeFromEnv)) {

            CalabashLogger.info(String.format("%s = %s from environment variable", ENV_JAVA_HOME, javaHomeFromEnv));
            return javaHomeFromEnv;
        }
        return null;
    }

    private static String findAndroidHome(AndroidConfiguration configuration) throws CalabashException {
        String androidHome = null;

        String androidHomeFromConfig = configuration.getAndroidHome();
        if (isNotEmpty(androidHomeFromConfig)) {
            androidHome = androidHomeFromConfig;
            CalabashLogger.info(String.format("%s = %s from configuration", ENV_ANDROID_HOME, androidHome));