On Mon, 25 May 1998, Fred Whipple wrote:

> I'm trying to work my way through the Java-CGI HOWTO, but have run into

Although I can't imagine why you'd want to write CGI scripts in Java other
than the "coolness factor," I think I can point out your problem.

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

There is your mistake.  You should always call programs by their full
pathnames whenever possible in scripts.  This is particularly important in
CGI scripts which do not inherit the same PATH environment variable that
you are used to seeing as a user.  Although, this is not DIRECTLY the
problem, it is still good practice.  But I bet that PATH problems are
still the fundamental problem. 

Unlike DOS, just because two programs are in the same directory, does not
necessarily mean they can call each other just by using their filename. 
Whenever a bash script tries to execute another program, it always uses
the PATH environment variable and ignores the current directory (unless
"." is in the PATH variable, which it should not be even though Red Hat
5.0 does so).  However, based on your statements the CGI bash script seems
to be finding the Java wrapper script, but the Java wrapper script isn't
able to find the Java interpreter.

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

If this is the path it is searching, no wonder.  Examine the path, and you
will see that it is really looking in
/usr/bin/bin/i586/green_threads/java
most likely this is not where your interpreter is.  But without your PATH
environment variable, your .java_wrapper can probably not find the
interpreter it is looking for.

You have three choices.  Either export the PATH environment variable with
the settings you need (which I don't know what they are, but the same PATH
you have as a user would probably do fine), rewrite the wrapper to set its
own PATH variable, or give up on the wrapper and code the correct
invocation of the interpreter directly into your CGI script. 


-- 
  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