I have two options – I can either use JNI or use Runtime.exec to execute a C++ library.
The C++ program is CPU intensive and long running i.e. some calls may take up to a couple of hours to return.
What are the pros and cons of each?
Which approach should I go for?
If you need to interact with the C++ library, go for JNI.
If it’s a standalone program that you just want to invoke (and perhaps grab the output),
Runtime.exec()is much, much simpler.