Is there a way to execute a command in java that doesn\'t suffer from the startup overhead (slowness) of using ProcessBuilder?
More detail: I am using im4java which
This is not recommended, but you could write a JNI library to do the same thing that ProcessBuilder is doing. Perhaps yours would be faster, but I wouldn't count on it, plus you would lose cross-platform compatibility.
How slow are we talking here? I'm using ProcessBuilder
myself for running Git commands (haven't had a chance to look into JGit yet), and it seems snappy enough. You may have better luck on Linux, as the overhead may actually be in Windows heavyweight process creation.
Runtime.getRuntime().exec(...)
can be used to run an external command. You can turn your List into a command array or a string to pass to exec().