public static void main(String args[]) {
    if (args.length == 0) {
      for (Object prop : System.getProperties().keySet()) {
        System.out.println(prop + "=" + System.getProperty((String) prop, ""));
      }
    } else {
      for (String prop : args) {
        System.out.println(System.getProperty(prop, ""));
      }
    }
  }
A generic way for querying Java properties.
hbase-server/src/main/java/org/apache/hadoop/hbase/util/GetJavaProperty.java