用小程序加载 .DLL 并在客户端上使用它 [英] Load .DLL with applet and use it on client

查看:45
本文介绍了用小程序加载 .DLL 并在客户端上使用它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在applet 内从服务器加载.dll 到客户端,然后在客户端调用加载的.dll 的方法(使用JNI)吗?

Can I load .dll from server to client within applet, and then call methods of loaded .dll (using JNI) on client side?

推荐答案

当然可以.小程序需要由开发人员进行数字签名,并得到最终用户的信任(他们在出现提示时单击确定").使用 archive 属性中的引用,将本机放在 Jar 的根目录中,并将其添加到小程序的运行时类路径中.

Certainly. The applet will need to be digitally signed by the developer, and trusted by the end user (they click 'OK' when prompted). Put the natives in the root of a Jar and add it to the run-time class-path of the applet, using a reference in the archive attribute.

使用使用 archive 属性将本机部署到小程序的传统方法有一个缺点,即每个客户端都会获得适用于 Windows、OS X 和 *nix 的本机.是他们实际需要的本地人数量的 3 倍.

Using the traditional method of deploying natives to an applet using the archive attribute has the disadvantage that every client gets the natives for Windows, OS X and *nix. 3 times as many natives as they actually need.

最近(Java 插件 2,在 Sun 的 1.6.0_10 版中引入)功能是使用 Java Web Start,然后允许我们为用户划分本地程序的下载.每个操作系统将只获得它需要的本地程序.

A recent (Java Plug-In 2, introduced in Sun's version 1.6.0_10) ability is to launch embedded applets using Java Web Start, which then allows us to partition the download of natives for the user. Each OS will get only the natives it needs.

..如何声明小程序类路径?

..how to declare applet class-path?

它在 资源部分.

E.G.来自文档.

<resources os="SunOS" arch="sparc">
  <nativelib href="lib/solaris/corelibs.jar"/>
</resources>

任何没有 osarch 属性的资源部分将被所有 JWS 客户端下载,其余的仅由匹配的客户端下载.

Any resources section with no os or arch attribute will be downloaded by all JWS clients, the rest only by those that match.

这篇关于用小程序加载 .DLL 并在客户端上使用它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆