Tuesday, September 13, 2011

Executing Java .jar within .NET

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;


//Get the output from stream

//in case of no error ExitCode will be zero
//In case of error , get error description
string error = process.StandardError.ReadToEnd();



1 comment:

Jonathan Elano said...

Thank you so much for the post. It is a great help for us! jvmhost

Why do we use np.random.seed()

This is a simple function but to my surprise lot of ML engineers had asked me about the actual usage of this function and why do I use it wh...