Пример #1
0
        public static string GetJavaVersion()
        {
            object value = JavaPath.GetJavaRegistry().GetValue("CurrentVersion", null);

            if (value == null)
            {
                throw new JavaNotFoundException();
            }
            return(value.ToString());
        }
Пример #2
0
        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());
        }
Пример #3
0
        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());
        }