ethrbunny
ethrbunny

Reputation: 10479

Java applet: run native code from browser?

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.

Upvotes: 1

Views: 7024

Answers (3)

Andrew Thompson
Andrew Thompson

Reputation: 168845

..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

Upvotes: 2

laz
laz

Reputation: 28648

The portable way of doing this is to create a signed Applet.

Upvotes: 0

Herms
Herms

Reputation: 38868

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).

Upvotes: 9

Related Questions