Hi!

I am having an issue with executing a .jar with php.
If I do

/opt/lampp/bin/php myphp.php

the jar gets executed and the output appears in the terminal.

But if I load the php page directly in my browser, the output of the jar when executed does not appear.

Is it possible that by the time the jar gets executed, my browser has finished processing the php page and since the jar takes a little bit more time, the output does not get displayed on my browser.

If its possible, is there a solution please?
Thank you!

What are you trying to achive? Why to mix two technologies (Java and PHP) together?

Hi! I am trying to display the output of my .jar file in a textarea by echoing the result obtained in my php file. But its not displaying anything.

Don't know how you doing execution and reading from command line but you can always save jar output into file and have your php page access the file in intervals.

PS: Nevertheless I still do not see point behind this exercise. Why would you want PHP listen for JAR output messages?

I think your solution is better.:)
But even if I do it this way, I still need to execute my jar file with PHP. And when I do
exec ('java -jar myjar.jar'); It does not work. :S

Any idea please?

I'm not PHP guy, but quick search turn up exec and here is sample of usage

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.