它不会创建Java VM(JNI) [英] It won't create a Java VM (JNI)
本文介绍了它不会创建Java VM(JNI)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的简单命令行应用程序:
int _tmain(int argc,_TCHAR * argv [])
{
JavaVM * jvm;
JNIEnv * env;
JavaVMInitArgs vm_args;
JavaVMOption选项[1];
options [0] .optionString =-Djava.class.path =。; // java源代码的路径
vm_args.version = JNI_VERSION_1_6; // JDK版本。这表示版本1.6
vm_args.nOptions = 1;
vm_args.options = options;
vm_args.ignoreUnrecognized = 0;
jint ret = JNI_CreateJavaVM(& jvm,(void **)& env,& vm_args);
return 0;
}
给我:
< block $>
VM初始化期间发生错误
无法加载本机库:找不到依赖库
从未到达return 0的断点。 jvm.dll位于与我的命令行应用程序相同的目录。
我不知道是什么问题。有任何想法吗? Thanx提前
解决方案
我认为您的问题由此问题在Sun JNI常见问题中。
TL; DR版本:不要移动JVM安装的DLL。
My simple command line app:
int _tmain(int argc, _TCHAR* argv[])
{
JavaVM *jvm;
JNIEnv *env;
JavaVMInitArgs vm_args;
JavaVMOption options[1];
options[0].optionString = "-Djava.class.path=."; //Path to the java source code
vm_args.version = JNI_VERSION_1_6; //JDK version. This indicates version 1.6
vm_args.nOptions = 1;
vm_args.options = options;
vm_args.ignoreUnrecognized = 0;
jint ret = JNI_CreateJavaVM(&jvm, (void**)&env, &vm_args);
return 0;
}
gives me:
Error occurred during initialization of VM Unable to load native library: Can't find dependent libraries
The breakpoint at "return 0" is never reached. jvm.dll resides in same directory as my command line app.
I don't get it what's wrong. Any Ideas? Thanx in advance
解决方案
I think that your problem is answered by this question in the Sun JNI FAQ.
TL;DR version: Don't move the JVM installation's DLLs.
这篇关于它不会创建Java VM(JNI)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文