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
Ashwath AlettyPosted Oct 25, 2010, 9:45 AM
{
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
Kirtan PatelPosted Jun 29, 2009, 3:10 AM
Posted Jun 28, 2009, 7:25 AM
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.