private void SpawnDebugger() { System.Diagnostics.Process debuggerProc = new System.Diagnostics.Process(); debuggerProc.EnableRaisingEvents = false; debuggerProc.StartInfo.WorkingDirectory = "bin"; debuggerProc.StartInfo.FileName = "java"; debuggerProc.StartInfo.Arguments = "-jar SoarJavaDebugger.jar -remote"; Trace.WriteLine("Spawning debugger in " + debuggerProc.StartInfo.WorkingDirectory); debuggerProc.Start(); bool ready = false; // do this loop if timeout seconds is 0 (code for wait indefinitely) or if we have tries left for (int tries = 0; tries < 15; ++tries) { _kernel.GetAllConnectionInfo(); if (_kernel.HasConnectionInfoChanged()) { for (int i = 0; i < _kernel.GetNumberConnections(); ++i) { ConnectionInfo info = _kernel.GetConnectionInfo(i); if (info.GetName() == "java-debugger") { if (info.GetAgentStatus() == sml_Names.kStatusReady) { ready = true; break; } } } if (ready) { break; } } Trace.WriteLine("Waiting for java-debugger..."); Thread.Sleep(1000); } if (!ready) { OnLog("Debugger spawn failed!"); } }