无法加载JVM [英] Cannot load JVM

查看:685
本文介绍了无法加载JVM的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从C运行代码从此处。试图运行JVM的代码如下:

  JNIEnv * env; 
JavaVMInitArgs vm_args;
JavaVMOption选项;
options.optionString =-Djava.class.path = D:\\Java Src\\\TestStruct;
vm_args.version = JNI_VERSION_1_6;
vm_args.nOptions = 1;
vm_args.options =& options;
vm_args.ignoreUnrecognized = 0;

int ret = JNI_CreateJavaVM(jvm,(void **)& env,& vm_args);

代码编译正常,但是当我尝试执行它时,我得到以下错误:


VM初始化期间发生错误无法加载本机
库:找不到相关库


查看问题,我使用依赖关系助手找出哪个二进制文件我缺少。原来我从我的电脑上缺少 ieshims.dll wer.dll this 提到的dlls

在我看来,有几个问题:




  • 如何我要摆脱这个吗?

  • 为什么会出现这个错误?我不能在XP中加载JVM?



我在Windows XP上使用Visual Studio 2008安装JDK 1.7

解决方案

在您链接的文章下面的讨论话题中有一个类似的问题。



在这里,一个用户发现解决方案是确保你有在 PATH 环境变量中的Java二进制文件的路径。例如:

  PATH =C:\Program Files\Java\jdk1.6.0_18\jre\ bin \client; ... 


I'm trying to run java code from C using code taken from here. The code that attempts to run JVM is as follows:

JNIEnv *env;
    JavaVMInitArgs vm_args;
    JavaVMOption options;
    options.optionString = "-Djava.class.path=D:\\Java Src\\TestStruct";
    vm_args.version = JNI_VERSION_1_6;
    vm_args.nOptions = 1;
    vm_args.options = &options;
    vm_args.ignoreUnrecognized = 0;

    int ret = JNI_CreateJavaVM(jvm, (void**)&env, &vm_args);

The code compiles fine however, when I try to execute it I get the following error:

Error occurred during initialization of VM Unable to load native library: Can't find dependent libraries

Looking at this question I used dependency walker to find out which binaries I'm missing. It turns out I'm missing ieshims.dll and wer.dll from my computer which according to this the mentioned dlls are used in vista and above (I'm on XP).
So several questions come to my mind:

  • How do I get rid of this?
  • Why am I getting this error in the first place? Can't I load JVM in XP?

I'm on Windows XP, using Visual Studio 2008, JDK 1.7 installed (tried with 1.6 too).

解决方案

There's a similar question in the discussion thread below the article that you linked.

In there, a user found that the solution is to make sure you have the path to your Java binaries in the PATH environment variable. For example:

PATH = "C:\Program Files\Java\jdk1.6.0_18\jre\bin\client";...

这篇关于无法加载JVM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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