Exemplo n.º 1
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());
        }
Exemplo n.º 2
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());
        }