Changes to Yarn branch for CDH5 and MR2

please also add parameter check for JAVA_HOME and HADOOP_HOME before line 57 ?