JNI Java in c ++ [英] JNI Java in c++
本文介绍了JNI Java in c ++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用以下代码在cplusplus程序中创建Java虚拟机:
I am trying to create Java Virtual Machine in a cplusplus program using the code as follows:
JNIEnv *env;
JavaVMInitArgs vm_args;
JavaVMOption options[1];
options[0].optionString = "-Djava.class.path=D:\\Java Src\\TestStruct"; //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;
int ret = JNI_CreateJavaVM(jvm, (void**)&env, &vm_args);
if(ret < 0)
printf("\nUnable to Launch JVM\n");
我无法创建实例,因为它给我以下错误。
我能够编译,但它给出了这样的运行时错误..
I am unable to create an instance as it is giving me the following error . I am able to compile but it is giving runtime error like this..
错误输出:
初始化VM $ b $期间出错b无法加载本机库:找不到依赖库
Error Output: Error occurred during initialization of VM Unable to load native library: Can't find dependent libraries
任何人都可以提前帮助我:)
Can anybody help me thanks in advance :)
推荐答案
很可能jvm.dll不在你的PATH中。
Most likely that jvm.dll isn't in your PATH.
这篇关于JNI Java in c ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文