Java with apache from perl script?

I

i5513

Hi, I'm running Apache server with mod_perl active.

I can run my script from command line and all is fine, but when I run
my script from navigator, it doesn't run fine because my script is:

....
system "java program_java";
....

How can I do Apache to run java programs?

Thanks you, I read on google about Tomcat and about Apache Jserver,
but I don't know where can I start.

PD: I'm sorry for my poor english.
 
B

Ben Morrow

Hi, I'm running Apache server with mod_perl active.

I can run my script from command line and all is fine, but when I run
my script from navigator, it doesn't run fine because my script is:

...
system "java program_java";
...

How can I do Apache to run java programs?

Not like that. Not, in fact, using Perl at all.
Thanks you, I read on google about Tomcat and about Apache Jserver,
but I don't know where can I start.

Start in an Apache or Java newsgroup.

Ben
 
S

Steve Grazzini

Ben Morrow said:
Not like that. Not, in fact, using Perl at all.

Why not? It just looks like "java" isn't in the CGI process's $PATH...
Since the OP's script runs from the command line but not the browser,
I'd recommend the troubleshooting links in the FAQ.

% perldoc -q 500
 
J

James Willmore

On 29 Oct 2003 09:26:16 -0800
Hi, I'm running Apache server with mod_perl active.

I can run my script from command line and all is fine, but when I
run my script from navigator, it doesn't run fine because my script
is:

...
system "java program_java";
...

How can I do Apache to run java programs?

If you want to have a Java Applet server, visit:

http://jakarta.apache.org/tomcat/index.html

<snip>

You _could_ use Perl to execute a Java application, but IMHO it would
be better to use an actual Java server to perform the task.

HTH

--
Jim

Copyright notice: all code written by the author in this post is
released under the GPL. http://www.gnu.org/licenses/gpl.txt
for more information.

a fortune quote ...
A fool must now and then be right by chance.
 
H

Helgi Briem

Hi, I'm running Apache server with mod_perl active.

I can run my script from command line and all is fine, but when I run
my script from navigator, it doesn't run fine because my script is:

system "java program_java";
How can I do Apache to run java programs?
CGI is run under a special user with restricted rights and
an empty path variable.

You should always, yes *always* check the results
of system operations and return the error ($! for
internal processes, $? for daughter process).

Give it the full path to java and the program.

my $java = '/full/path/to/java';
my $program_java = '/full/path/to/program_java';
system ($java $program_java) == 0 or die $?;
 
I

i5513

Give it the full path to java and the program.
my $java = '/full/path/to/java';
my $program_java = '/full/path/to/program_java';
system ($java $program_java) == 0 or die $?;

Thanks you, my 'particular' problem was the classpath.

I solved it with:
$Output = qx/"java -cp /full/path/to/classes
/full/path/to/program_java"

on my local apache it seems like perl had C:\winnt\system32 on
$ENV{PATH}. Java.exe was on winnt\system32 ... I think my perl script
isn't a CGI program where you says path is empty.

Thanks you again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top