Fix Java 7 detection

For legacy reasons, Java directs `-version` output to STDERR rather than STDOUT.