<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi everyone,<div><br></div><div>We are using VTK via Java for 3D rendering purposes in the open-source Icy platform for bioimaging (<a href="http://icy.bioimageanalysis.org">http://icy.bioimageanalysis.org</a>), and it has been a great experience so far (especially on Windows). Less so on Mac however, mostly due to Apple’s custom JVM implementation (1.6) messing with the lightweight/heavyweight thingy, and the dramatic changes when switching to Java 1.8 (Oracle). </div><div><br></div><div>— The story starts when compiling VTK with Java bindings (after I installed Oracle’s JDK 8 on Mavericks 10.9.2, Xcode 5.1). At runtime, vtk viewers that used to work under JDK 6 suddenly cause a bad crash (note that this also happened with Oracle’s JDK 7):</div><div><div><span class="Apple-tab-span" style="white-space: pre;"> </span>_NSJVMLoadLibrary: NSAddLibrary failed for /libjawt.dylib</div><div><span class="Apple-tab-span" style="white-space: pre;"> </span>JavaVM FATAL: lookup of function JAWT_GetAWT failed. Exit</div></div><div><br></div><div>— I figured VTK probably wasn’t properly talking to JDK 8, and noticed in CMakeLists that the JAVA_XXX flags were pointing to some weird bits of Java frameworks inside Xcode (in a MacOS10.9 resource bundle), therefore I changed them to:</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>JAVA_AWT_INCLUDE_PATH<span class="Apple-tab-span" style="white-space:pre"> </span>/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/include <br><span class="Apple-tab-span" style="white-space:pre"> </span>JAVA_AWT_LIBRARY<span class="Apple-tab-span" style="white-space:pre"> </span>/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/libjawt.dylib <br><span class="Apple-tab-span" style="white-space:pre"> </span>JAVA_INCLUDE_PATH<span class="Apple-tab-span" style="white-space:pre"> </span>/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/include <br><span class="Apple-tab-span" style="white-space:pre"> </span>JAVA_INCLUDE_PATH2<span class="Apple-tab-span" style="white-space:pre"> </span>/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/include/darwin</div><div><br></div><div>— This change wouldn’t compile anymore, due to the following line (appears twice in Wrapping/Java/vtkJavaAwt.h):</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>temp0->SetWindowId(dsi_mac->cocoaViewRef);</div><div>(problem: the cocoaViewRef field does not exist anymore). Commenting this line however resumes compilation (but could cause the issue below).</div><div><br></div><div>— Once compiled, I took the sample code from this web site: <a href="http://www.particleincell.com/blog/2011/vtk-java-visualization/">http://www.particleincell.com/blog/2011/vtk-java-visualization/</a>. Here is the outcome:</div><div><br></div><div>— — Under JDK 6: the vtk panel nicely sits “inside” the main frame, where it is supposed to be (expected behaviour).</div><div><br></div><div>— — Under JDK 8, the vtk panel opens in a new (native Mac) window entitled “Visualization Toolkit - Cocoa #1”, while the main frame sits there with all other UI components, except the center zone is empty (it is like “sucked away” into the native window:)). Additionally, the Apple toolkit at runtime is complaining with the following console warning:</div><div><br></div><div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">2014-04-09 19:05:10.178 java[2935:790f] Cocoa AWT: Not running on AppKit thread 0 when expected. (</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><span class="Apple-tab-span" style="white-space:pre"> </span>0 libawt_lwawt.dylib 0x00000001255c3887 -[AWTWindow windowDidResignKey:] + 40</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><span class="Apple-tab-span" style="white-space:pre"> </span>1 CoreFoundation 0x00007fff90f8ce0c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><span class="Apple-tab-span" style="white-space:pre"> </span>2 CoreFoundation 0x00007fff90e80a6d _CFXNotificationPost + 2893</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><span class="Apple-tab-span" style="white-space:pre"> </span>3 Foundation 0x00007fff862bb7ba -[NSNotificationCenter postNotificationName:object:userInfo:] + 68</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><span class="Apple-tab-span" style="white-space:pre"> </span>4 AppKit 0x00007fff89156760 -[NSWindow resignKeyWindow] + 702</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><span class="Apple-tab-span" style="white-space:pre"> </span>5 AppKit 0x00007fff8905b363 -[NSWindow _changeKeyAndMainLimitedOK:] + 768</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><span class="Apple-tab-span" style="white-space:pre"> </span>6 AppKit 0x00007fff89053856 -[NSWindow _makeKeyRegardlessOfVisibility] + 100</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><span class="Apple-tab-span" style="white-space:pre"> </span>7 AppKit 0x00007fff890537c0 -[NSWindow makeKeyAndOrderFront:] + 29</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><span class="Apple-tab-span" style="white-space:pre"> </span>8 libvtkRenderingOpenGL.jnilib 0x000000012c854d71 _ZN20vtkCocoaRenderWindow13CreateAWindowEv + 2113</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><span class="Apple-tab-span" style="white-space:pre"> </span>9 libvtkRenderingOpenGL.jnilib 0x000000012c855af8 _ZN20vtkCocoaRenderWindow10InitializeEv + 344</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><span class="Apple-tab-span" style="white-space:pre"> </span>10 libvtkRenderingOpenGL.jnilib 0x000000012c851e6d _ZN20vtkCocoaRenderWindow5StartEv + 29</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><span class="Apple-tab-span" style="white-space:pre"> </span>11 libvtkRenderingCore.jnilib 0x0000000129db9fad _ZN15vtkRenderWindow14DoStereoRenderEv + 29</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><span class="Apple-tab-span" style="white-space:pre"> </span>12 libvtkRenderingCore.jnilib 0x0000000129db9f6c _ZN15vtkRenderWindow10DoFDRenderEv + 1612</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><span class="Apple-tab-span" style="white-space:pre"> </span>13 libvtkRenderingCore.jnilib 0x0000000129db98fd _ZN15vtkRenderWindow10DoAARenderEv + 1837</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><span class="Apple-tab-span" style="white-space:pre"> </span>14 libvtkRenderingCore.jnilib 0x0000000129db8ec2 _ZN15vtkRenderWindow6RenderEv + 2418</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><span class="Apple-tab-span" style="white-space:pre"> </span>15 libvtkRenderingCoreJava.jnilib 0x0000000129b2f291 Java_vtk_vtkRenderWindow_Render_19 + 49</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><span class="Apple-tab-span" style="white-space:pre"> </span>16 ??? 0x000000010ec0a66e 0x0 + 4542473838</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><span class="Apple-tab-span" style="white-space:pre"> </span>17 ??? 0x000000010ebfd2e0 0x0 + 4542419680</div></div><div><br></div><div><br></div><div>In both cases, the viewers behave identically.</div><div><br></div><div>I apologise for the long post, but I assume this is sufficiently complete to describe and reproduce the problem.</div><div>Has anyone experienced this lately? Any hints on why the behaviour is different? I could not find any similar issue on the forum…</div><div><br></div><div>Many thanks for your attention, and looking forward to updates on the Mac port!</div><div><br></div><div>Best wishes</div><div>Alexandre</div><div><br><div apple-content-edited="true">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div style="color: rgb(0, 0, 0); font-family: Didot; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div style="color: rgb(0, 0, 0); font-family: Didot; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div style="color: rgb(0, 0, 0); font-family: Didot; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div style="color: rgb(0, 0, 0); font-family: Didot; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div style="font-size: 16px;">---</div><div apple-content-edited="true" style="font-size: 16px;"><div>Alexandre Dufour, Ph.D.</div><div>Institut Pasteur - Bio Image Analysis Group</div><div>25, rue du Docteur Roux, Paris, France</div></div><div style="font-size: 16px;">Research: <a href="http://www.bioimageanalysis.org/dufour">http://www.bioimageanalysis.org/dufour</a></div><div style="font-size: 16px;">Software: <a href="http://icy.bioimageanalysis.org">http://icy.bioimageanalysis.org</a></div></div></div></div></div></div>
</div>
<br></div></body></html>