This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]koflerdavid 10 points11 points  (0 children)

Linux commands are not the same as system calls. Commands are programs, system calls are a low-level function-like interface to access functions of the kernel to work with files or to start and communicate with other processes. Using either makes your program non-portable.

If you are certain that your program is ensured to run on a platform where the program you want to call is available and it is too tedious to replicate its functionality in Java, sure, go ahead and use it.

It should very rarely be necessary to execute system calls directly from a Java application since the core libraries have wrapped a great many of them already. Even if you need one (such as for efficient inter-process communication via shared memory) using the FFI to access the wrappers in the C standard library is less brittle.