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

//K0ns3rv

Hey.

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:

<?php
exec('java -jar /pat/to/file.jar', $output);
print_r($output);
?>

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

I want send it a variable as input.Haow I do it?

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.

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.