Running java from C ++ on linux

I am very new to C ++ programming on Linux and I want to run a java program from C ++. When I do this:

int main() {

    system("java -jar /home/user/test/test.jar argument");
    cout << "The end" << endl;
    return 0;
}

my main process waits until Java is complete and then continues. Is there any way to “start” java without stopping my main process? Thanx in advance!

+4
source share
1 answer

Adding a and at the end of the command should unlock it and allow your program to continue, for example:

int main() {
system("java -jar /home/user/test/test.jar argument &");
cout << "The end" << endl;
return 0;}

I have something similar and it works fine.

+4
source

All Articles