0

I tried JAVA bridge to get output from my jar file followed this https://stackoverflow.com/a/10253798/1870048, I am using XAMP Server and from that Apache and Tomcat server is been used

  require_once("http://localhost:8080/JavaBridge/java/Java.inc");     
  $cartObj = Java("Cart"); //Javav("Cart");
  $cartObj->Cart("098765");
  $cartObj->setLang("EN");
  echo  $cartObj->getLang();

but gives error : Fatal error: Call to undefined function Javav() What should I exactly I look into?

Also I tried below way also to call the jar file by placing the jar file in my zampp htdoc folder: (D:\xampp\htdocs\jar)

//  Using shell_exec
exec('java -jar AutoDiscounts.jar '.$jsonRequest.' 2>&1', $result);
print_r($result);

//  Using shell_exec
$arg1 = $jsonRequest;//"My_INPUT_PARAMETER";
$output = '';
$output =shell_exec("java -jar AutoDiscounts.jar $arg1");
echo "Done calling shell exec:";
echo $output;

But both above cases does not give any output .Basically my jar will do some cart processing and return output and it works in the JDevloper

enter image description here

3
  • 1
    Is Java.inc in the PHP language? Does it define a class for Javav? Commented Apr 15, 2020 at 17:11
  • @GetSet yes there was no such function but now I checked there is Java function so changed the function name now but gives another error Commented Apr 15, 2020 at 17:26
  • Javabridge is a network based protocol, you can't just include the jar... you need a server (with jar's you need), There's a standalone version, but I suggest to have a look to belgattitude.github.io/soluble-japha first. It's a reworked version of the javabridge... Commented Apr 16, 2020 at 7:30

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.