Forum Stats

  • 3,826,780 Users
  • 2,260,707 Discussions
  • 7,897,072 Comments

Discussions

JDK 1.8 - JNI_CreateJavaVM hangs

manuelcr
manuelcr Member Posts: 7
edited May 14, 2014 5:10AM in Java Native Interface (JNI)

Hi, we have a C++ application which creates a JavaVM using JNI.

It has been working with JDK 1.6 and 1.7, but when we have updated to Java 8, it hangs when invoke JNI_CreateJavaVM.

We have tested with JDK 1.8.0 and 1.8.0 update 5.

If we come back to JDK 1.7, it works fine again.

We have compiled alll our C++ code linking to the Java 8 libraries.

Our Environment:

- Jdk 8

- RedHat 6.3

- x64

Any idea about it?

Answers

  • jschellSomeoneStoleMyAlias
    jschellSomeoneStoleMyAlias Member Posts: 24,877 Gold Badge

    If it is nothing but CreateJavaVM then you should be able to create a new application which does nothing but invoke that and it should hang as well.

    If it doesn't hang then it suggests that either something you are doing prior to that method is causing the failure or a compiler/linker option is causing it.  You might also look to see what command line options you are using.

  • manuelcr
    manuelcr Member Posts: 7
    edited May 14, 2014 6:29AM

    Hi, thanks for your answer.

    I have made an example in a new class and it works fine.

    We have seen that the creation hangs when we have a library with our code (with the JNI_CreateJavaVM) and use it making a 'dl_open'.

    If we don't use dl_open with the same library, the CreateJavaVM works fine. But, why does it fail if we load the library with dl_open now?

    Regards,

    Update:

    We have seen that the java lib tries to make a dlopen in its initialization, and it generates a lock with our previous dlopen. This only happens with JDK 1.8, using 1.7 it works fine.

This discussion has been closed.