Problem in running java jar file in agi

Hi .
I am trying to run a jar file in perl agi (tryjar.agi) like
exec(“java -jar util.jar RTSEND 23”);
when i run tryjar.agi from command line like
shell > perl tryjar.agi
it runs nicely ans shows the out put.but when i call tryjar.agi from extensions.conf , all other statements in tryjar.agi are executed but the statement
exec(“java -jar util.jar RTSEND 23”);
is skipped.I have also tried
exec(“java -cp /var/lib/asterisk/agi-bin/ -jar util.jar”);
but the same problem again.
I have also tried to call it like
$AGI->exec(“System”, “java -cp /var/lib/asterisk/agi-bin/ -jar util.jar RTSEND 48”);
but it does’nt works .
can any body help me out please.
Regards
Adnan

check to make sure all your java environment vars are set up correctly

thanks alot
it worked like
my $rs = $AGI->exec(“System”, “/opt/jdk1.6.0_03/bin/java -jar /var/lib/asterisk/agi-bin/util.jar RTSEND 23”);

it requires the complete java installation path.(/opt/jdk1.6.0_03/bin/)
           Regards
                     Adnan