设置Java Applet的工作目录

发布于 2024-08-15 22:54:09 字数 412 浏览 8 评论 0原文

我有两个签名的 Jars,a.jar 和 b.jar。 a.jar 在浏览器内作为小程序启动,b.jar 位于 Appdata/locallow/xyz (Vista) 中。 a 将 b 添加到它的类路径中并调用 b.jar 的一些函数。到目前为止,一切都很好。现在b将一些dll解压到工作目录中并依赖它们。它必须是工作目录,因为 dll 相互引用,因此不可能有其他目录。 不好的是,Firefox 中的工作目录(user.dir)是“c:\program files\mozilla firefox”...所以只要用户具有管理员权限,我的应用程序就可以工作。但是,一旦普通用户启动小程序,它就会崩溃,因为应用程序想要解压 dll。无论如何,在 Firefox 的目录中包含 application-dll 确实不太好...... 解决方案是将工作目录设置为 dir,其中 b.jar 所在的位置。这有可能吗?

I have two signed Jars, a.jar and b.jar.
a.jar is launched as an applet inside the browser and b.jar is in Appdata/locallow/xyz (Vista). a adds b to it's classpath and calls some functions of b.jar. So far so good. Now b unpacks some dlls into the working directory and depends on them. It must be the working directory, because the dlls reference each other, so no alternative directory is possible.
The bad thing is, that the working directory (user.dir) in Firefox is "c:\program files\mozilla firefox"... So my application works as long as the user has admin-rights. But as soon as a normal user launches the applet, it crashes as the application wants to unpack the dlls. And it really isn't nice to have application-dlls in the directory of Firefox anyway...
A solution would be to set the working directory to the dir, where b.jar is. Is this possible in any way?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

毁虫ゝ 2024-08-22 22:54:09

小程序方法不太适合本机库。

我建议考虑 Java Web Start,它直接包含对 DLL 的支持。它在 Java 6 中经过重新设计,也可以很好地与小程序一起使用。

The applet approach is not well suited for native libraries.

I would suggest considering Java Web Start which contains support for DLL's directly. It was reworked in Java 6 to work well with applets too.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文