C ++ JNI要安装Mac Legacy JRE6 [英] C++ JNI wants to install Mac Legacy JRE6

查看:111
本文介绍了C ++ JNI要安装Mac Legacy JRE6的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了JDK8,并将我的JAVA_HOME设置为正确的路径.我可以毫无问题地使用Java.但是,当我尝试从C ++运行Java代码时,它提示我安装一个真正旧的JRE6版本.

I have JDK8 installed and my JAVA_HOME is set to the correct path for that. I can use Java without any problems. However, when I try to run Java code from C++, it prompts me to install a really old version of JRE6.

在我的代码中,我有:

JavaVMInitArgs vm_args;
vm_args.version = JNI_VERSION_1_8;

所以请求JRE6很奇怪.如何获得C ++ JNI来使用现有的JDK8安装?

so it is weird that JRE6 is being requested. How can I get C++ JNI to use my existing JDK8 installation?

推荐答案

由于某种原因,当代码使用libjvm.dylib时,会发生这种情况.还有libjli.dylib,它具有相同的功能,但会跳过JRE 6对话框.我从来没有想过要检查为什么会这样.

For some reason this happens when code uses libjvm.dylib. There's also libjli.dylib which has the same functions but skips the JRE 6 dialog. I've never bothered to check why it is that way.

如果与-ljvm链接,请将其替换为-ljli.如果将dlopendlsym一起使用,只需在其中使用其他库名即可.

If you link with -ljvm, replace this with -ljli. If you use dlopen together with dlsym just use the other library name there.

这篇关于C ++ JNI要安装Mac Legacy JRE6的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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