How do I start a java application from a C# application?
I’m working on a minecraft launcher. Is there a general method to start any jar from a C# application?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You could start the jar file as a new process:
This assumes
javais in yourPATH(which happens by default when java is installed). If not, use the absolute path to java.This is starting the game directly – you can use the minecraft launcher if the user told you where they put it. On windows, that’s an exe, so you can start it directly.
Also, APPDATA is a window’s variable. For linux, the path is in
$HOME, or~/. Also, the params aren’t quite the same. Assuming your users will run your app with Mono for linux (or apple). I don’t have Mono handy to test the options for you, but you can useTo help you select the correct start path. The above code was found here. I note that the property in the sample above is called
IsLinux, yet the quote from Mono docs says6is for Mac OS X. This leads me to believe the property should actually be calledIsUnix(as apple fanatics continue to preach such is the case though apple is as much unix as windows is dos). I don’t have macware on hand to test this, I leave that to the student.