you should be doing this in a Java class not a JSP. JSPs are only for presentation. Search for MVC for more details.
The Runtime.exec() and ProcessBuilder APIs let you make command line calls on the server the JSP is running on. For some other server, you'd need to run a command remotely through your server which still uses Runtime.exec() or ProcessBuilder.