将 jre 与我的应用程序一起打包
我的应用程序包含一个 c++ exe 文件,该文件使用 JNI 调用 java 程序,因此需要 jvm.dll。但是,我希望我的应用程序附带其自己的嵌入式 jre,但在复制 JAVA_HOME 中找到的 jre6 文件夹并将其添加到我的安装程序后,它无法运行该程序(VM 初始化期间发生错误无法加载本机库:可以找不到依赖库),当我在 jvm.dll 上使用 dependency walker 时,它说找不到 gpsvc.dll、IEShims.dll 和 sysntfy.dll。在我尝试将这些 dll 复制到与 jvm.dll 相同的文件夹后,依赖关系遍历器告诉我 gpsvc.dll 和 sysntfy.dll 是 64 位,而它应该是 x86。问题是,这些是我系统上唯一的 dll,我该怎么办?
My application contains an c++ exe file which invokes a java program using JNI, thus requiring jvm.dll. However, I want my application to ship with its own embedded jre but after I copy the jre6 folder found in JAVA_HOME and added it to my installer, it fails to run the program(Error occurred during initialization of VM Unable to load native library: Can't find dependent libraries), when I use dependency walker on jvm.dll, it says that it can't find gpsvc.dll, IEShims.dll and sysntfy.dll. After I tried copying those dlls to the same folder as jvm.dll, dependency walker tells me that gpsvc.dll andsysntfy.dll is 64 bit where it should be x86. Problem is, those were the only dlls on my system, what should I do?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Java 虚拟机不仅仅包含
jvm.dll
。您需要重新分发整个 JVM 包并将其安装在用户的计算机上,而不是仅仅将jvm.dll
添加到您自己的应用程序中。要求用户在安装应用程序之前自行下载并安装 JVM 可能会容易得多。如果您确实想随应用程序一起重新分发 JVM,则需要在 Oracle 网站上查找文档,了解该操作的确切许可证是什么以及如何执行此操作。请参阅 JDK 6 自述文件的本段,了解例子。
它并不像复制 jvm.dll 及其依赖的其他库那么简单。
The Java virtual machine consists of much more than just
jvm.dll
. You'll need to redistribute the whole JVM package and install that on a user's machine instead of just addingjvm.dll
to your own application.It will probably be much easier to require your users to download and install the JVM themselves before installing your application. If you really want to redistribute the JVM with your application, you'll need to find documentation on Oracle's website on what the exact license for that is and on how to do it. Look at this paragraph of the JDK 6 readme, for example.
It's not as simple as copying
jvm.dll
and other libraries that it depends on.您可以从适当的站点下载所需的 dll,即从此站点。
You may download the required dll's from the appropriate sites, i.e. from this one.