On 08/09/2010 11:19 PM, Lothar Werzinger wrote: > I am trying to use Java scripting (JSR 223) with GCJ. > To do that I tried compiling the scripting jar file that implements JSR 223 > into a shared library and to use it in my app. > However I always get a SIGSEGV in the init function of the shared library. > > As you can see (in the build.sh script) I tried all combinations of > -findirect-dispatch and -fno-indirect-classes without success. > > Any help to get that running is highly appreciated. You are trying to redefine one of gcj's core classes, sun.reflect.Reflection. This is never going to work, no matter what combination of options you try to use: the compiled binary interface requires core classes to be unique. So, I removed the classes that already exist in libgcj, and it gets much further. You have to call JvAttachCurrentThread. -findirect-dispatch -fno-indirect-classes is correct. Your main program should look like this: result = ::JvCreateJavaVM( &vm_args // JvVMInitArgs ); JvAttachCurrentThread (NULL, NULL); std::cerr << "Create JavaVM done." << std::endl; try { ::javax::script::ScriptEngineManager * j_scriptEngineManager = new ::javax::script::ScriptEngineManager(); ::javax::script::ScriptEngine * j_engine = (j_scriptEngineManager->getEngineByName (::JvNewStringUTF("jython") )); j_engine->eval(::JvNewStringUTF("print('hello python')")); } catch (jthrowable t) { t->printStackTrace(); } Andrew.