Try
string path = Process.Start(new ProcessStartInfo("where", "java") { UseShellExecute = false, RedirectStandardOutput = true, CreateNoWindow = true }).StandardOutput.ReadToEnd().Trim();
Help: where /?
where /?