简体   繁体   中英

C++ JNI wants to install Mac Legacy 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.

In my code I have:

JavaVMInitArgs vm_args;
vm_args.version = JNI_VERSION_1_8;

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

安装了JDK8,但提升安装JRE6。

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM