class MRApps extends Apps {

  @SuppressWarnings("deprecation")
  public static void setClasspath(Map<String, String> environment,
      Configuration conf) throws IOException {
    boolean userClassesTakesPrecedence = 
      conf.getBoolean(MRJobConfig.MAPREDUCE_JOB_USER_CLASSPATH_FIRST, false);

    String classpathEnvVar =
      conf.getBoolean(MRJobConfig.MAPREDUCE_JOB_CLASSLOADER, false)
        ? Environment.APP_CLASSPATH.name() : Environment.CLASSPATH.name();

    String hadoopClasspathEnvVar = Environment.HADOOP_CLASSPATH.name();

    MRApps.addToEnvironment(environment,
      classpathEnvVar, crossPlatformifyMREnv(conf, Environment.PWD), conf);

    MRApps.addToEnvironment(environment,
        hadoopClasspathEnvVar, crossPlatformifyMREnv(conf, Environment.PWD),
        conf);

    if (!userClassesTakesPrecedence) {
      MRApps.setMRFrameworkClasspath(environment, conf);
    }

    addClasspathToEnv(environment, classpathEnvVar, conf);
    addClasspathToEnv(environment, hadoopClasspathEnvVar, conf);

    if (userClassesTakesPrecedence) {
      MRApps.setMRFrameworkClasspath(environment, conf);
    }
  }

}