Jeferson Martinelli
Jeferson Martinelli

Reputation: 21

Call a .jar file from JS or PHP

I need to execute a .jar file when the user executes a JS event.

When the user starts the JS event (by clicking on a button), a JS function needs to start a .jar file located in the user's computer.

I have been looking for it, and all the answer that I got point me to use PHP instead of JS in this situation.

Can anyone help me with that?

Is the exec() PHP method the best way to solve the problem?

Thanks :)

Upvotes: 1

Views: 2299

Answers (2)

randrade86
randrade86

Reputation: 346

It is not possible to do this.

PHP can only run code in your server. You cannot force a client to run a jar file (unless they are using an exploited browser).

Upvotes: 0

Hidro
Hidro

Reputation: 41

shell_exec("java -jar your_JAR.jar arg1 arg2");

I've found it here.

Hope it helps!

Upvotes: 1

Related Questions