Re: running a jar file via perl cgi



Butterpants <admin@xxxxxxxxx> wrote in message news:<rWADe.7729$je2.697111@xxxxxxxxxxxxxxxxxxxxx>...
> I have a jar file that works well by typing on the shell
> ./java -jar myjar.jar in.txt out.txt
>
> but when i try to create a cgi script it will not write the out.txt file
> There is a textarea form as the input, when user hits submit the script
> below gets called. The script gets as far as writing the in.txt file
> with the correct contents but no out.txt file is created so the problem
> must lie with executing the jar file. Any idea why not?
>
> #!/usr/bin/perl
> use strict;
> use CGI qw/:standard/;
> my $goal=param("goal");
> print header;
> print start_html;
> print "<h3>co</h3>";
> print "<xmp>\n";
> print "goal is this: $goal";
> print `echo "$goal" > in.txt`;
> print `./java -jar ModuleB.jar in.txt out.txt`;
> print `cat out.txt`;
> #print `rm -f in.txt out.txt`;
> print "</xmp>\n";
> print end_html;

I have only a guess: it could be path problem. Your CGI-Environment
possibly does not know the pathes. Use absolute pathes instead of
../java , ModuleB.jar etc.


Cheers


Bernd
.