Hello friends.
I am currently involved in a project where we want to export data from mysql to xls, for this we have written a program that is in *jar format.
What we want to do is execute this file through php after which we will send it to the user.
We have to code to send to the user but need a functional method to execute the jar file.

P.S Time consumption has little or no priority D.S


Edited by K0ns3rv: n/a

8 Years
Discussion Span
Last Post by Atli


If you can execute your JAR file via a command line, you could use the exec function to execute it and capture the output.

For example:

exec('java -jar /pat/to/file.jar', $output);

Which would print every line of output generated by the JAR file.


The above does the job but silently, do you know how to run a jar file so that it does everything that the jar file suppose to do (i.e. open up another browser... and rest of the instructions)? (not in the background though)


PHP executes on the server. If you want Java code to be executed on the client, you need to execute it on the client. PHP can't help you with that. Look into Java applets if you want this done through the browser. - However, applets understandibly have strict security restrictions. You may need to create a normal Java client app for full functionality.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.