private void jdkLabel_Click(object sender, EventArgs e) { DialogResult search = MessageBox.Show("Search Again?", "JDK & JRE Location", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (search == DialogResult.Yes) { RegistryManager.UpdateJDK(false, ""); searchJDKWorker.RunWorkerAsync(); } }
private void BeginSearch(string[] path) { RegistryManager.Init(); if (!RegistryManager.JDKFound) { // first check if jdk has not been found if (!jdkFound) { // first look if the path exists try { Process proc = new Process(); proc.StartInfo.UseShellExecute = false; proc.StartInfo.FileName = "javac"; proc.StartInfo.CreateNoWindow = true; proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; proc.Start(); proc.Close(); jdkFound = true; } catch (System.ComponentModel.Win32Exception ex) { for (int i = 0; i < path.Length; i++) { if (Directory.Exists(path[i])) { if (list.Count > 0) { string p = list[0].Replace("javac.exe", ""); jdkFound = true; jdkpath = p; } else { RecurseFind(path[i], list); } } } } } RegistryManager.UpdateJDK(jdkFound, jdkpath); } }