title: How to get HDFS and YARN version programmatically?
body: <p>I'm writing a spark program that download different jars from maven based on the environment it runs on, each for a different version of Hadoop distribution (e.g. CDH, HDP, MapR).</p>
  
  <p>This is necessary because some low-level APIs of HDFS and YARN are not shared between these distributions. However, I cannot find any public API of HDFS and YARN that tells their version.</p>
  
  <p>Is it possible to do it only in Java? Or I have to run an external shell to know it?</p>