开发者

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 t开发者_如何学Chis was dated 2002. Im wondering if this model / concept is no longer supported.


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


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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜