Using JAWT CALayer with QT

Mike Swingler swingler at apple.com
Sun Aug 5 17:34:33 PDT 2012


Does anyone know if there is a bug tracking the creation of an OS X-specifc jawt_md.h? I'm not seeing one in either the jdk8 or the jdk7u-* repositories, and this is a pretty crucial part of the JNI story to be leaning on Apple's deprecated JavaVM.framework.

~Mike

On May 21, 2012, at 2:55 PM, Jessica Finley <jfinley at tech4learning.com> wrote:

> Update for posterity:
> 
> So, I changed the awt.version back to JAWT_VERSION_1_4 and referenced the <JavaVM/jawt_md.h> instead of the JDK7 jawt_md.h (while continuing to link to the Java7 libs instead of the JavaVM framework) and it works!
> 
> That seems odd to "mix and match" like that, but I suppose it makes sense.  I need Apple's header to define some stuff for me, yet I need JDK 7's libraries to do the execution.
> 
> Thanks,
> Jess
> 
> On May 21, 2012, at 1:41 PM, Jessica Finley wrote:
> 
>> So, I've modified the project to not use the JavaVM framework, and to instead point to jdk1.7.0_06.jdk/Contents/Home/jre/include headers and associated libraries (libawt.dylib, libjawt.dylib).  I left out the NativeDrawnCanvas.java and DrawingCanvas.m classes, since they use deprecated NSView based drawing.  Additionally, I modified the awt.version in LayerCanvas.m to be 
>>   awt.version = JAWT_VERSION_1_7 | JAWT_MACOSX_USE_CALAYER; // opt into the CALayer model
>> 
>> Now, when I run the application, I no longer get the error ([java] JavaVM WARNING: JAWT_GetAWT must be called after loading a JVM), but instead the canvas doesn't draw anything at all.  I get no warnings about loading the resources for the layers or anything like that, so I'm assuming it's finding them (I made changes so instead of referencing the resources from the app bundle, they are referenced absolutely on the file system).
>> 
>> Any ideas as to why nothing is being drawn at all?  Let me know if you want my modified example project to take a look at. 
>> 
>> Has anyone gotten any sort of CALayer drawing working with Java 7?  At this point, I'm not as much interested in QT specifics as much as just getting _something_ working.
>> 
>> Thanks,
>> Jess
>> 
>> 
>> On May 17, 2012, at 3:55 PM, Jessica Finley wrote:
>> 
>>> Hiya folks,
>>> 
>>> It is my understanding that we are to use CALayer based embedding now instead of NSView based embedding.  Can someone explain to me how to do so?  Primarily, I am interested in playing a QT movie.  I've been looking at the JAWTExample project located here:
>>> 
>>> https://developer.apple.com/library/mac/#samplecode/JAWTExample/Introduction/Intro.html#//apple_ref/doc/uid/DTS10000683-Intro-DontLinkElementID_2
>>> 
>>> Which works beautifully in Java 6, but no so much in Java 7.  When run in Java 7 (after some finagling to launch the jar outside of its app bundle so it will run in Java 7), I get the following error when trying to draw the included QT movie:
>>>   [java] JavaVM WARNING: JAWT_GetAWT must be called after loading a JVM
>>> 
>>> I'm not really sure why this doesn't work in Java 7, since it is using CALayer embedding, as it should… I think.  
>>> 
>>> Thanks!
>>> -Jess
>> 
> 
> 



More information about the macosx-port-dev mailing list