Click here to Skip to main content
15,896,557 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a java executable jar file called SearchGUI-X.Y.Z.jar

How do I wrap it into a C# application using system.diagnostics? The code below shows how to run the java application using the command line. However, it doesn't seem to work using Process.Start etc etc as it only opens the applications GUI and doesn't take in the arguments

C#
java -cp SearchGUI-X.Y.Z.jar 
eu.isas.searchgui.cmd.IdentificationParametersCLI [parameters]
Posted

You need to use following to execute jar file.

1. Create a Process object and instantiate the StartInfo property for that object.
2. Set StartInfo.FileName with path to java.exe file.
3. Set StartInfo.Arguments property to -jar [jar file path here] [more arguments if needed].
4. Start the process using Process.Start method on object you created in step 1.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900