Process.Start(jrekeypath);
Thread.Sleep(5);
foreach (Process clsProcess in Process.GetProcesses())
{
if (clsProcess.ProcessName.StartsWith("javaw"))
{
clsProcess.Kill();
}
}
It doesn’t kill the process. Is there any problem in this snippet?
5 ms is not an extremely long time. Could it be that the process has in fact not yet started when your code looks for it, but instead starts shortly afterwards?