0

I am trying to open jar file from C# code. Here is my code,

myProcess.StartInfo.UseShellExecute = false;
myProcess.StartInfo.FileName = "java";
myProcess.StartInfo.Arguments = "-jar D:\\DATA\\PROJECT\\LicensingManagement\\Assignment\\JavaLogin.jar";
myProcess.Start();

it is working fine, but jar file opens with command prompt, Is there any way to open jar file without command prompt? thanks in advance.

Planet-Zoom
  • 1,005
  • 2
  • 9
  • 20

1 Answers1

2

Have you tried something like this:

var processInfo = new ProcessStartInfo("java.exe", "-jar app.jar")
                  {
                      CreateNoWindow = true,   /*no window*/
                      UseShellExecute = false
                  };
Process proc;

if ((proc = Process.Start(processInfo)) == null)
{
  //do someting usefull with the error
}

proc.WaitForExit();
proc.Close();
Dawnkeeper
  • 2,844
  • 1
  • 25
  • 41