views:

66

answers:

3

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?

+2  A: 

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

Colin Hebert
+2  A: 

This would be the closest thing: Java Web Start

Aaron
+5  A: 

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.com/myapp.jnlp";

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

Marcus Adams
I'll second Java Web Start - has worked well for my projects, the only constraint is that the user must have a relatively recent browser / Java version installed but my experience is that most people have that nowadays.
mikera
This is however not a desktop program as you would expect (installed on the local PC). This is a Java software package installed on the server. See as example http://www.devdaily.com/java/misc/TypeAhead/. We for example use ScrumWorks as a web-served desktop application.
extraneon
@extraneon, it doesn't require an installation wizard to install, yet it is indeed a desktop application. Once the user gives it permission, it runs on the user's desktop and has full access to the system. It doesn't require an application server. The web browser caches the app, so it only gets downloaded again when you put a newer file on the server. The user can also install a shortcut on their desktop to launch it from there. The exact steps on how to do this vary depending on the OS/browser.
Marcus Adams