I tried to execute a .jar
using HTML
or PHP
.
In the first case I wrote the code below:
<applet code=Diagnostica.class
archive="Diagnostica/Diagnostica.jar"
width="120" height="120">
</applet>
This way doesn't work cause the file Diagnostica.jar
need to contain an applet
I suppose.
So I tried the second option in PHP
:
exec("java -jar Diagnostica/Diagnostica.jar");
This way it works. Diagnostica.jar
starts outside the browser, but I want to start it inside the browser.
How can I do?
If that file does not contain an Applet, I do not think you will be able to start it in the browser (have a look here).
Executing it via exec
should work like executing it via the command line - but as you already noticed, it will be run on the server - not the client.
If it should run on the client, you'll either have to use a Java Applet or let the user download the jar-executable and execute it via command line etc.