code: private static String getProjectIdFromEnv() {
      if (System.getenv(PROJECT_ID_ENV_VAR) != null) {
        return System.getenv(PROJECT_ID_ENV_VAR);
      }
      String projectIdFromComputeEngine = getProjectIdFromComputeEngine();
      if (projectIdFromComputeEngine != null) {
        return projectIdFromComputeEngine;
      }
      throw new IllegalStateException(String.format("Could not determine project ID."
          + " If you are not running on Compute Engine, set the"
          + " %s environment variable.", PROJECT_ID_ENV_VAR));
    }
docs: Determines the project id from the environment. Uses the following sources in order of
  preference:
  <ol>
  <li>Value of the DATASTORE_PROJECT_ID environment variable
  <li>Compute Engine
  </ol>
  
  @throws IllegalStateException if the project ID cannot be determined