/// <summary> /// Handler when the Scan Button got clicked /// For example checking if scan is allowed and then statrting it /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void startserver() { Process process = new Process(); String jarFile = System.AppDomain.CurrentDomain.BaseDirectory + "../../server.jar"; GlobalSettingsDialog dialog = new GlobalSettingsDialog(); String[] delemitter = dialog.getSifUrlTextBox().Split(':'); String ip = delemitter[0] + ":" + delemitter[1]; ip = ip.Replace("http://", ""); ; int port = Int32.Parse(delemitter[2]); var arguments = String.Format(" -jar {0} -Ip {1} -Port {2}", jarFile, ip, port); // indicate, that you want to capture the application output process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; // create a process instance var javaExecutable = "java.exe"; // and instruct it to start java with the given parameters var processStartInfo = new ProcessStartInfo(javaExecutable, arguments); process.StartInfo = processStartInfo; // start the process process.Start(); // read the output from the started appplication string output = process.StandardOutput.ReadToEnd(); process.WaitForExit(); }