Execute native code via JNI/DLL or EXE?-Collection of common programming errors
I would strongly recommend the .exe approach.
- if it crashes you can respawn the .exe
- you won’t suffer from memory leaks / corruptions etc.
The downside is that you may have to parse the .exe output to determine results/status etc., and if it’s not designed for this, then this might be impractical (or impossible, even).
But as a first approach, spawning the .exe is the way to go. Don’t forget to consume the stdout/err concurrently to avoid any .exe hanging problems (a common problem, if SO questions are to be believed).