admin管理员组

文章数量:1287820

How can I execute a desktop application from a browser?. I have a web page with a button, when user click this button a simple java desktop application must run. How can I do this using jsp or javascript?

How can I execute a desktop application from a browser?. I have a web page with a button, when user click this button a simple java desktop application must run. How can I do this using jsp or javascript?

Share Improve this question asked Oct 12, 2010 at 19:25 DorrDorr 1331 gold badge4 silver badges8 bronze badges 3
  • 2 You cannot do that without sending an ActiveX control or something along with your page. With just Javascript it is impossible. And of course an ActiveX control will be pretty useless to your users with Macs, or who don't ever install ActiveX controls. – Pointy Commented Oct 12, 2010 at 19:28
  • 1 If you find a way be sure to let the virus writers of the world know, sounds like an easier way to deploy than what they have now. – tloach Commented Oct 12, 2010 at 19:30
  • 1 @tloach - running a downloaded Java application securely is totally possible, Java Web Start runs in a secure sandbox by default so it wouldn't be of much use to virus writers. Of course it gets riskier if you need enhanced permissions like full file system access.... :-) – mikera Commented Oct 12, 2010 at 19:54
Add a ment  | 

4 Answers 4

Reset to default 7

Java Web Start might be your solution.

To start a Java Web Start application, you simply direct the browser to the location of the JNLP file. Basically, the browser detects that instead of simply downloading the file, it should run it in Web Start.

Most major browsers support Java Web Start. Java Web Start is cross platform (works on Mac and PC).

So, in Javascript, it's done simply like this:

window.location = "http://www.examples./myapp.jnlp";

You'll also need to sign your Java application, or the user will get a nasty warning.

You should take a look at the Java Web Start technology.

This would be the closest thing: Java Web Start

Managing this through Applets is another option though the underlying scheme is the same, the user needs to accept the generated certificate.

本文标签: javaExecute application from web browserStack Overflow