In a nutshell,
- JNI and JNA permit using native libraries in the same process.
Runtime.exec
(and it's newer friendProcessBuilder
) launch new external applications.
Since each requires cooperation with the host operating system and an existing native binary (whether it's a library or a runnable program) none of them is platform-indepedent.
None of the three permits communicating with a running external application. To do that you need an inter-process communication mechanism, which can be implemented on top of shared memory, files, pipes, or sockets for example.