I need some suggestion. I am almost finish with my program but stuck at the final step.
I am trying to run a java file from C# using:
Process.start(“java”,”file”) //with file = file.class (already compiled java filed)
the process will fire a cmd and execute the java file
everything work fine but the cmd close too fast, it doesn’t matter whether my java file ask for input or not, at the end, after completion, cmd just automatically close.
Since cmd is external application, I have no control over it in C#:
used Process.WaitForExit(); but same effect because cmd, as i said, external
is there anyway I can pause cmd using c#, or set up cmd somehow so it will not close (just once, not every times i want to run lol). I want to see the output
this has to be done without any modification to java because i will be running multiple java files in the same way.
Try this:
The
/Kflag tellscmdto run the supplied command but not to close the window afterwards.