JPype not working inside stream?

I tested a simple global hello line to test JPype:

jpype.java.lang.System.out.println ("hello world")

It works great in the context of the "main" python program. However, in the context of the current thread, I get the following response:

# # A fatal error has been detected by the Java Runtime Environment: # # SIGSEGV (0xb) at pc=0x00007f5272aeb226, pid=7888, tid=139991902578432 # # JRE version: 7.0_01-b08 # Java VM: Java HotSpot(TM) 64-Bit Server VM (21.1-b02 mixed mode linux-amd64 compressed oops) # Problematic frame: # C [_jpype.so+0x33226] JPJavaEnv::FindClass(char const*)+0x36 # # Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again # # An error report file with more information is saved as: # /home/imedia/NTsvm/src/server/nlp/hs_err_pid7888.log # # If you would like to submit a bug report, please visit: # http://bugreport.sun.com/bugreport/crash.jsp # Aborted 
+4
source share
1 answer

referring to JPype documentation :

Python Themes

For the most part, python threads based on OS level threads (e.g. posix threads) will work without problems. The only thing to remember is to call jpype.attachThreadToJVM() in the body of the thread so that the JVM is used from that thread. For threads that you don't run yourself, you can call isThreadAttachedToJVM() to check.

NTN

+8
source

All Articles