Commit 99ae5a89 authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

Add line about Java version back to flutter doctor (#8332)

Line was accidentally removed by #8320

Also, change the version check from `java` to `javac` since we need the JDK and not just the JRE.
parent 6d135e45
...@@ -70,14 +70,11 @@ class AndroidWorkflow extends DoctorValidator implements Workflow { ...@@ -70,14 +70,11 @@ class AndroidWorkflow extends DoctorValidator implements Workflow {
String javaVersion; String javaVersion;
try { try {
printTrace('java -version'); printTrace('javac -version');
ProcessResult result = processManager.runSync(<String>['java', '-version']); ProcessResult result = processManager.runSync(<String>['javac', '-version']);
if (result.exitCode == 0) { if (result.exitCode == 0)
javaVersion = result.stderr; javaVersion = result.stderr.split('\n')[0];
List<String> versionLines = javaVersion.split('\n');
javaVersion = versionLines.length >= 2 ? versionLines[1] : versionLines[0];
}
} catch (error) { } catch (error) {
} }
...@@ -86,6 +83,7 @@ class AndroidWorkflow extends DoctorValidator implements Workflow { ...@@ -86,6 +83,7 @@ class AndroidWorkflow extends DoctorValidator implements Workflow {
'No Java Development Kit (JDK) found; you can download the JDK from $_kJdkDownload.' 'No Java Development Kit (JDK) found; you can download the JDK from $_kJdkDownload.'
)); ));
} else { } else {
messages.add(new ValidationMessage('Java Development Kit (JDK) found: $javaVersion'));
type = ValidationType.installed; type = ValidationType.installed;
} }
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment