The moose likes Tomcat and the fly likes Java  & CGI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Java  & CGI" Watch "Java  & CGI" New topic

Java & CGI

victor kamat
Ranch Hand

Joined: Jan 10, 2007
Posts: 247
Can somebody guide me to material that will help me run a Java Program thru CGI.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63870

Java as CGI? Why?

[Asking smart questions] [About Bear] [Books by Bear]
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13037
Java servlets use the conventions of CGI - Common Gateway Interface just like all other web servers.

Do you have an existing Java program that must be executed through a request to a servlet? If not, why are you posting in the Tomcat forum?

Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 15100

This forum is not only about Tomcat, you can also ask questions about Apache HTTP server here.

Running Java programs as CGI is not a good idea. It will be really slow, because each time the webserver needs to call your Java program, it has to start up a new JVM process (which is slow) to run your Java program.

You should really use servlets instead of trying to run Java programs via CGI.

If you have an Apache HTTP server running as your web server, then you could connect Tomcat to it and run your servlets in Tomcat.
[ December 12, 2007: Message edited by: Jesper Young ]

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
I agree. Here's the link:
subject: Java & CGI
jQuery in Action, 3rd edition