Is it still possible to start a 'native' application under windows via a java applet in a browser? IE "Click here to start notepad.exe" on a web page. The most recent reference I could find for this was dated 2002. Im wondering if this model / concept is no longer supported.
-
2did you try the approach you found? did it work? – Mat Jun 02 '11 at 14:44
-
Its so old that some of the packages aren't available anymore. Getting it to build was beyond me. – ethrbunny Jun 02 '11 at 14:46
-
here is an IE solution: http://codereflex.net/how-to-run-exe-on-webpage/ --> I need something browser neutral though. – ethrbunny Jun 02 '11 at 14:50
-
1Java can certainly do it.. now I just need to remember how to write an applet.. – ethrbunny Jun 02 '11 at 14:59
3 Answers
Yes, but the applet has to be signed.
Signed applets will prompt the user to give them permission. Once given, the applet has the same rights as any application running on the machine, including the ability to launch native apps (or link native libraries, which I've had to do in the past).

- 37,540
- 12
- 78
- 101
-
This worked fine. I was overthinking it. Self-signing does make for a popup that needs to be explained "no really - you can trust me" but that's doable. – ethrbunny Jun 03 '11 at 11:41
-
Is there a good way to bundle the native lib so that it gets downloaded onto the user's hard drive? What path should you use when you call System.loadLibrary()? – Jesse Barnum Dec 07 '11 at 04:18
-
I believe you can include it in your jar file, but I haven't tried that (we had the applet download it on the fly so it could pick up updates to the dll). – Herms Dec 08 '11 at 20:28
..Is it still possible to start a 'native' application under windows via a java applet in a browser?
Sure thing. As mentioned in other replies, a signed (and trusted) applet can use Runtime.exec(String)
to launch a native application.
As of Java 1.6, it becomes simpler with the implementation of Dekstop.getDesktop.open(File)
, which will open the selected File
with whatever application the OS has registered as a consumer for that file type.
As of Sun's Plugin2 architecture (1.6.0_10+ in a Sun/Oracle JRE) offers a more generic method for an (sand-boxed) applet embedded in a web page, using the JNLP API's BasicService
. Here is my demo. of the BasicService

- 168,117
- 40
- 217
- 433
-
Didn't know about the Desktop stuff (haven't had a chance to use 1.6) Can you do do the Desktop.open() method on an exe to launch it? And does that work in unsigned applets, or does it still need to be signed? – Herms Jun 02 '11 at 15:56
-
@Herms: An applet needs to be trusted to use the methods of the `Desktop` class. – Andrew Thompson Jun 02 '11 at 15:59
-
The BasisService still does not offer starting a native application, does it? Or do you use a `file:` URL to run a local application? – Paŭlo Ebermann Jun 02 '11 at 18:19
-
@Paŭlo Ebermann: You are correct, but the `BasicService` can be used to launch JWS based desktop applications. – Andrew Thompson Jun 03 '11 at 02:41