public static string GetJavaVersion() { object value = JavaPath.GetJavaRegistry().GetValue("CurrentVersion", null); if (value == null) { throw new JavaNotFoundException(); } return(value.ToString()); }
public static string GetJavaHome() { object obj = JavaPath.GetJavaRegistry().OpenSubKey(JavaPath.GetJavaVersion()); if (obj == null) { throw new JavaNotFoundException(); } obj = ((RegistryKey)obj).GetValue("JavaHome", null); if (obj == null) { throw new JavaNotFoundException(); } return(obj.ToString()); }
public static string GetJavaBinaryPath() { object obj = JavaPath.GetJavaRegistry().OpenSubKey(JavaPath.GetJavaVersion()); if (obj == null) { throw new JavaNotFoundException(); } obj = ((RegistryKey)obj).GetValue("JavaHome", null); if (obj == null) { throw new JavaNotFoundException(); } obj = Path.Combine(obj.ToString(), "bin"); if (!Directory.Exists(obj.ToString())) { throw new JavaNotFoundException(); } return(obj.ToString()); }