I want to open a .jar file when a button is clicked in Windows. I have the following code:
private: System::Void btnStartServer_Click(System::Object^ sender, System::EventArgs^ e) {
STARTUPINFO si;
PROCESS_INFORMATION pi;
int spi=sizeof(pi);
int ssi= sizeof(si);
ZeroMemory( &si, sizeof(si) );
si.cb=sizeof(STARTUPINFO); //sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
char b = 0;
b = CreateProcess("C:\\Program Files\\Java\\jre7\\bin\\java.exe ", "-jar craftbukkit.jar", NULL, NULL, 0, CREATE_NO_WINDOW, NULL, NULL, &si, &pi);
btnStartServer->Text = String::Format(L"{0}", b);
}
But when I press the button the button's text changes to "1", but I don't see any proccess called "java" in Task Menager.
If you know how to open, read output and give input to/from a .jar file, I'd appreciate if you answered: How To Open, Read Output and Give Input To a .jar file with C++?.
Any help would be appreciated.