Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/Xamarin.Android.Tools.AndroidSdk/JdkInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,23 @@ Dictionary<string, List<string>> GetJavaProperties ()
return GetJavaProperties (ProcessUtils.FindExecutablesInDirectory (Path.Combine (HomePath, "bin"), "java").First ());
}

static bool AnySystemJavasInstalled ()
{
if (OS.IsMac) {
string path = Path.Combine (Path.DirectorySeparatorChar + "System", "Library", "Java", "JavaVirtualMachines");
if (!Directory.Exists (path)) {
return false;
}

string[] dirs = Directory.GetDirectories (path);
if (dirs == null || dirs.Length == 0) {
return false;
}
}

return true;
}

static Dictionary<string, List<string>> GetJavaProperties (string java)
{
var javaProps = new ProcessStartInfo {
Expand All @@ -209,6 +226,10 @@ static Dictionary<string, List<string>> GetJavaProperties (string java)

var props = new Dictionary<string, List<string>> ();
string curKey = null;

if (!AnySystemJavasInstalled () && (java == "/usr/bin/java" || java == "java"))
return props;

ProcessUtils.Exec (javaProps, (o, e) => {
const string ContinuedValuePrefix = " ";
const string NewValuePrefix = " ";
Expand Down