Troubles with launching Java GUI from C++
843829Apr 30 2004 — edited May 1 2004Hi,
I'm launching a Java program from my C++ program (in linux). For C++ I'm using the Xm library for the GUI. When I want to instantiate a new Java object, I get the following error:
An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : 11 occurred at PC=0x4015C475
Function=XmRenderTableFree+0x15
Library=/usr/X11R6/lib/libXm.so.2
This is a backtrace (see #17):
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1024 (LWP 19643)]
0x4015c475 in XmRenderTableFree () from /usr/X11R6/lib/libXm.so.2
(gdb) backtrace
#0 0x4015c475 in XmRenderTableFree () from /usr/X11R6/lib/libXm.so.2
#1 0x40153cd9 in XmFontListFree () from /usr/X11R6/lib/libXm.so.2
#2 0x4c6ed4c4 in Java_sun_awt_motif_MComponentPeer_pSetFont () from
/localhost/packages/java/j2sdk1.4.0/jre/lib/i386/libawt.so
#3 0x423b6129 in ?? ()
#4 0x423aef93 in ?? ()
#5 0x423aef93 in ?? ()
#6 0x423aef93 in ?? ()
#7 0x423aef93 in ?? ()
#8 0x423aeebc in ?? ()
#9 0x423aef93 in ?? ()
#10 0x423aef93 in ?? ()
#11 0x423ac195 in ?? ()
#12 0x404d6156 in JavaCalls::call_helper () from
/localhost/packages/java/j2sdk1.4/jre/lib/i386/client/libjvm.so
#13 0x40570ccd in os::os_exception_wrapper () from
/localhost/packages/java/j2sdk1.4/jre/lib/i386/client/libjvm.so
#14 0x404d62a4 in JavaCalls::call () from
/localhost/packages/java/j2sdk1.4/jre/lib/i386/client/libjvm.so
#15 0x404de12d in jni_invoke () from
/localhost/packages/java/j2sdk1.4/jre/lib/i386/client/libjvm.so
#16 0x404de94e in jni_NewObjectV () from
/localhost/packages/java/j2sdk1.4/jre/lib/i386/client/libjvm.so
#17 0x0804d27b in JNIEnv_::NewObject (this=0x819af2c, clazz=0x819b938,
methodID=0x8293af8) at /localhost/packages/java/j2sdk1.4/include/jni.h:840
#18 0x0804cb0a in AppletViewer::AppletViewer (this=0x81a5628,
appletA=0x8193438) at AppletViewer.cc:227
#19 0x0804e17b in Applet::move (this=0x8193438, drawX=18, drawY=25,
drawWidth=376, drawHeight=77, scrollX=0, scrollY=0, dpi=86) at Applet.cc:329
#20 0x0808b852 in PageAttrs::moveApplets (this=0x8192dd8, drawX=18,
drawY=25, drawWidth=376, drawHeight=77, scrollX=0, scrollY=0, dpi=86) at
Page.cc:321
#21 0x080ae6ab in XPDFCore::moveApplets (this=0x81698d0) at Page.h:190
#22 0x080ac87f in XPDFCore::displayPage (this=0x81698d0, pageA=2, zoomA=1,
rotateA=0, scrollToTop=1, addToHist=1) at XPDFCore.cc:585
#23 0x080acac3 in XPDFCore::gotoNextPage (this=0x81698d0, inc=1, top=1) at
XPDFCore.cc:670
#24 0x080b3901 in XPDFViewer::nextPageCbk (widget=0x8149ff0, ptr=0x81408e8,
callData=0xbffff6d0) at XPDFViewer.cc:1229
#25 0x401df59e in XtCallCallbackList () from /usr/X11R6/lib/libXt.so.6
#26 0x400b5803 in ActivateCommon () from /usr/X11R6/lib/libXm.so.2
#27 0x400b5689 in Activate () from /usr/X11R6/lib/libXm.so.2
#28 0x4020c453 in _XtMatchAtom () from /usr/X11R6/lib/libXt.so.6
#29 0x4020cd3e in _XtMatchAtom () from /usr/X11R6/lib/libXt.so.6
#30 0x4020cdf4 in _XtTranslateEvent () from /usr/X11R6/lib/libXt.so.6
#31 0x401ea462 in XtDispatchEventToWidget () from /usr/X11R6/lib/libXt.so.6
#32 0x401ead7e in _XtOnGrabList () from /usr/X11R6/lib/libXt.so.6
#33 0x401eafc8 in XtDispatchEvent () from /usr/X11R6/lib/libXt.so.6
#34 0x401eb3d9 in XtAppMainLoop () from /usr/X11R6/lib/libXt.so.6
#35 0x080ab04c in XPDFApp::run (this=0x81175b0) at XPDFApp.cc:299
#36 0x080b8eef in main (argc=2, argv=0xbffffa84) at xpdf.cc:283
Now here's the interesting thing: in the constructor of my Java class there's a call to pack() to initiate my Java GUI. When I remove that call everything works fine (but then I haven't got a GUI though). setVisible(true) in the Java code also gives that problem.
Has C++ or the Xm library some troubles with the Java GUI? Or what the hell is going wrong?
PS: On Solaris, the very same code works perfectly...