using System.Diagnostics;
Process process = new Process();
//Path wherein Java is installed in your machine
process.StartInfo.FileName = "java.exe";
//.jar file to be executed
process.StartInfo.Arguments = @"-jar Sample.jar";
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
process.Start();
//Get the output from stream
Console.WriteLine(process.StandardOutput.ReadToEnd());
//in case of no error ExitCode will be zero
if(process.ExitCode)
{
//In case of error , get error description
string error = process.StandardError.ReadToEnd();
}
Console.WriteLine(error);
process.WaitForExit();
Subscribe to:
Post Comments (Atom)
Gray Failures: What is it and how to detect one?
If you are reading this article , i guess you are curious to know about gray failures and different methods to detect gray failures. Hopefu...
-
Note : In below scenario jenkins was deployed in Linux container Scenario: Jenkins build failed with error. java.io.IOException: error...
-
SharePoint Capacity Planning Tool on Microsoft Download Center: http://go.microsoft.com/fwlink/?LinkID=93029 System Center Capacity Planner:...
-
Error when installing NPM Profile not found. Tried ~/.bashrc, ~/.bash_profile, ~/.zshrc, and ~/.profile. Fix: Run command and try a...
1 comment:
Thank you so much for the post. It is a great help for us! jvmhost
Post a Comment