Hi all,

Beating my head here...

I'm trying to work my way through the Java-CGI HOWTO, but have run into
a more fundamental problem here.  I know I have the CGI-BIN and all set
up properly, and all should be right.

I have a simple Java class:

public class test {
        public static void main (String argv[]) {
                System.out.println ("Content-type: text/plain");
                System.out.println ("");

                System.out.println ("This is a line.");
        }
}

and a simple CGI script:

#!/bin/sh

CLASSPATH=/usr/lib/jdk-1.1.5/classes.zip:.
export CLASSPATH

# test.class is in the same directory as test.cgi,
# so there should be no problem calling the program like this:
java test

The paths are set up, the classes are okay, and both the test.cgi and
test.class files are in /home/httpd/cgi-bin (fresh out of box
configuration for Apache).  I know for sure that test.cgi is executing
because I can add cute test lines before trying to call the java class,
and I see everything fine up to that point.  Now, I go to the page to
run the CGI, and I get the "internal error" message from the Web
server.  Looking into /var/log/httpd/error_log, I see this every time I
try to access the script:

java was not found in /usr/bin/jdk-1.1.5/../bin/i586/green_threads/java

Okay.  I know where the message is comming from, since I'm using the
jdk-1.1.5-5 in the /contrib/hurricane/SRPMS folder, I know that
/usr/bin/java is a link to /usr/bin/jdk-1.1.5/java which in turn is a
link to /usr/bin/jdk-1.1.5/.java_wrapper which is a script that executes
different things based on how it was called (i.e. java, javac, javah,
etc.).  The last 2 lines of the script are:

echo >&2 "$progname was not found in ${prog}"
exit 1

So obviously that's where the error message is coming from in the Apache
error log.  I admit I'm not a master Bourne shell scriptor, and I can't
see just where the .java_wrapper script goes with its statements.  Nor
can I figure out just why having a shell running under a Web server
executing java <blah blah> should be any different than running it from
the command line in a shell.  Something is clearly wrong with the
environment as set up by the Web server.

Anyone have any ideas?  I'm fresh out of clues.

Thanks,

        -Fred


-- 
  PLEASE read the Red Hat FAQ, Tips, Errata and the MAILING LIST ARCHIVES!
http://www.redhat.com/RedHat-FAQ /RedHat-Errata /RedHat-Tips /mailing-lists
         To unsubscribe: mail [EMAIL PROTECTED] with 
                       "unsubscribe" as the Subject.

Reply via email to