On the Mac you can call whatever you want from within Java using the syntax Runtime.getRuntime().exec("some command");
In this case, it would be just like you typed "some command" into a terminal window.
Haven't tested on Windows, but surely there's something similar.