Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't execute Java app through CGI in IIS

Status
Not open for further replies.

rtgordon

Programmer
Jan 17, 2001
104
US
I downloaded ActivePerl, and I can execute cgi and perl scripts, but I can't execute (at least I think that it isn't executing) my java program. Based on my understanding... when you System.out.println from a java program through cgi, it dumps it out to the browser.

My classpath has the cgi-bin directory where my java program is, and the appropriate NT and IIS security settings are in place. Default user has read/execute on that dir, and cgi-bin is set to execute including script. I can navigate through DOS, and execute the program at the command line.

What could I possibly be missing?

This is the output

'E:\Inetpub\ script produced no output

My java program (I am just trying to verify that you can do this):


public class HelloWorld {
public static void main(String args[]) {
if (args.length <= 0) {
System.out.println(&quot;Hello World&quot;);
} else { // there are command line arguments
for (int i = 0; i < args.length; i++) {
System.out.println(args);
}
}
}
}

My cgi without the long classpath:

#!/bin/sh
CLASSPATH=.:long_classpath_here:./
export CLASSPATH
java HelloWorld
 
I should have used the code tags...

that should be

Code:
System.out.println(args[i]);

not

System.out.println(args);
 
ahhh... I can see the light ;-)

duh, my classpath is way wrong. I can't do that. I executed it with the perl interpreter instead of just at the browser and saw the error of my ways. I realize this becomes more of a CGI problem at this point... but, I am confused about how to set this variable in such a fashion in the NT environment. If anyone can shed some light, or point me to a resource I would be very grateful... I can't find much on cgi and java in the NT world. I am having to learn and try from all of the Unix examples.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top