Thursday 15 April 2010

php - Calling java program dependent on external library -


I am trying to call a Java program to use with the Java interface.

The Java program is dependent on external libs: commons-cli-1.2.jar

So basically I need to export it before calling the Java program; But if I export it for the first time:

  shell_exec ('Export Classes: $ CLASSPATH: ~ / lib / commons-cli-1.2.jar');  

Then call the Java program like this:

  shell_exec ('java computegearank -i $ para_i -d $ para_d -e $ para_e -o $ Para_o ');  

I think it makes different shells for each call; There is no effect of export on the Java program. Or am I wrong?

Otherwise, it should output a file to the server. But just this is not so, what is wrong? Any ideas?

Edit: However this may be because some parameters like parameters stand for the input filename, so should I specify the full path for this? Because I think the input file is in the same work directory, then there will be no problem, right?

Edit-2: It outputs properly when I use the command line;)

You are right, each shell_exec creates a separate shell.

  env CLASSPATH = whatever java-suites  

No comments:

Post a Comment