If you hava server which will run CGI scripts, then you can call a CGI by opening a URL to the appropriate URL which you would use to call the CGI from a browser. To attempt to run a CGI directly from your servlet is both difficult and error prone. Java is not good at setting "environment variables" and they are a key part of the CGI specification.