Apple's Java, which is on version 6 on my machine, has a class com.apple.eawt.CocoaComponent
for connecting AWT/Swing apps to Cocoa components. An example use: displaying the UI of an AudioUnit (which is a Cocoa view) in a Java app. I'd like to use Java 7, but I can't find this class in it. Anyone know if it's there, somewhere? Or if there is an alternative?
Asked
Active
Viewed 1,023 times
5

Rob N
- 15,024
- 17
- 92
- 165
-
Hi, have you found a solution for that? I've also some classes extending CocoaComponent which fail on Java 7. – Christof Aenderl Nov 18 '12 at 21:23
-
No solution yet. This project is on the back burner for a bit, and I haven't been working on it. – Rob N Nov 29 '12 at 23:59
-
Hm. All I've found is this on the JDK OSX-Port status page: "Use CALayer-based JAWT embedding instead of CocoaComponent". So you have to implement your own native windows. I tell you if I've some working code. – Christof Aenderl Nov 30 '12 at 13:38
2 Answers
2
The com.apple.eawt
classes are indeed included with the Oracle JDKs from 7u4 up through the latest (as of 10/30/2012) 7u9. For some example usage, see Fullscreen feature for Java Apps on OSX Lion or FullScreen Swing Components Fail to Receive Keyboard Input on Java 7 on Mac OS X Mountain Lion
One issue is that they do not seem to be building javadoc for those classes at the moment, so looking up the latest APIs is fairly difficult. I've resorted to searching for the .java files online. You may also have some luck with the older API reference on developer.apple.com, though this does not include newer classes like FullScreenUtilities.

Community
- 1
- 1

Vermillion002
- 261
- 2
- 7
-
Okay, I just installed 7u10 on my Macbook. The rt.jar does have classes in the com.apple.eawt package, but no `CocoaComponent`, which is what I'm looking for. – Rob N Nov 30 '12 at 00:30
0
There are at Marven repo for eg, you can pull it: here
Hope it helps
-
I can find the classes there, or in a few other places, but if I try to run the app in Java 7, the Cocoa view is never created and I get exceptions in CocoaComponent.paint. These Apple classes seem to be incompatible with the Java 7 VM from Oracle. – Rob N Sep 17 '12 at 12:17