Hi everybody, im trying to execute a .jar file in my c# program, i have try several times and get examples, but i can't do it.
I execute in the cmd, like this
java -Xms60m -Xmx256m -jar C:\\Programming\\Interface.jar";
and this open the program.
But, trying with the Process class:
Process process = new Process();
System.Diagnostics.ProcessStartInfo procInfo =
new System.Diagnostics.ProcessStartInfo("java -Xms60m -Xmx256m -jar C:\\Programming\\Interface.jar");
process = System.Diagnostics.Process.Start(procInfo);
and other instructions, i get an exception, the file can't be found.
Some one knows??
Thanks in advance.
Loading

Posted Jun 28, 2009, 3:25 AM EDT
For example, use
new System.Diagnostics.ProcessStartInfo(@"C:\Program Files\Java\jdk1.6.0_14\bin\java", "-Xms60m -Xmx256m -jar MyJar.jar")
Note also that the full path to the java executable is required where the java executable is not in the path.
Kirtan PatelRank #292 · 8.6K reputationPosted Jun 28, 2009, 11:10 PM EDT
string filename = "jar File Path Here"; Process p = new Process(); p.StartInfo.FileName = "java.exe"; p.StartInfo.Arguments = "-jar "+filename ; p.Start();Ashwath Aletty2 reputationPosted Oct 25, 2010, 5:45 AM EDT
{
string filename = @"D: jar path MyJar.jar arg1 arg2 arg3 arg 4...... ";
Process p = new Process();
p.StartInfo.FileName = @"C:\Program Files\Java\jre1.5.0\bin\java.exe";
p.StartInfo.Arguments = "-jar " + filename;
p.Start();
}
its working fyn