// my command R < /Users/Adva/Desktop/repository/esm/dev/workspace/it.unibz.esm/resources/r/r.in.txt --no-save > /Users/Adva/Desktop/repository/esm/dev/workspace/it.unibz.esm/resources/r/r.out.txt //the code String[] cmd = {"/bin/sh", "-c", "myCmd"}; try { Runtime.getRuntime().exec(cmd); } catch (IOException e) { e.printStackTrace(); }