anchor.diff:    return argParser;
   }
   
  +/// On macOS, we can try to find Java 1.8.
  +///
  +/// Otherwise, default to whatever JAVA_HOME is already.
  +Future<String> getJavaHome() async {
  +  if (Platform.isMacOS) {
  +    final ProcessResult result = await processManager.run(
  +      <String>['/usr/libexec/java_home', '-v', '1.8', '-F'],
  +    );
  +    if (result.exitCode == 0) {
  +      return result.stdout.trim();
  +    }
  +  }
  +  return Platform.environment['JAVA_HOME'];
  +}
  +
   /// Checks that `java` points to Java 1.8.
   ///
   /// The SDK lint tool may not work with Java > 1.8.
   Future<void> checkJava1_8() async {
     print('Checking Java version...');
  +
  +  if (Platform.isMacOS) {
  +    final ProcessResult result = await processManager.run(
  +      <String>['/usr/libexec/java_home', '-v', '1.8', '-F'],
  +    );
  +    if (result.exitCode != 0) {
  +      print('Java 1.8 not available - the linter may not work properly.');
  +    }
  +    return;
  +  }
     final ProcessResult javaResult = await processManager.run(
       <String>['java', '-version'],
     );
  
positive.code:   if (argResults['html']) {
      lintArgs.addAll(<String>['--html', argResults['out']]);
    }
    final Process lintProcess = await processManager.start(lintArgs);
    lintProcess.stdout.pipe(stdout);
    lintProcess.stderr.pipe(stderr);
    return await lintProcess.exitCode;
  
negative.code:         'Ensure Java is installed and available on your path.');
      print(javaResult.stderr);
    }
    // `java -version` writes to stderr.
    final String javaVersionStdout = javaResult.stderr;
    if (!javaVersionStdout.contains('"1.8')) {
      print('The Android SDK tools may not work properly with your Java version. '
          'If this process fails, please retry using Java 1.8.');
    }
  