Can Java 7 use Apple Java Extensions?

巧了我就是萌 提交于 2019-12-01 16:38:08

问题


In order to help Java apps look more like native apps when run on Mac OS X, Apple created the Apple Java Extensions in order to make Java apps behave more like Mac OS X. These allow for things like handling the behavior of the "About" menu and supporting drag and drop onto the application icon.

However, I can't find anything indicating whether or not these extensions are included with Java 7 or even usable with Java 7. It is my understanding that Apple merged their OS X implementation into OpenJDK, but I'm not sure whether these extensions went with it. I do see that the goal for the Mac OS X port of OpenJDK aims to "Include a complete, native Cocoa-based UI Toolkit", but I can't find much about what this entails. Searching the web has not proved very fruitful and I have no idea about if they are compatible with Java 7 or are even included.

So I guess I have three questions:

  • Will a Mac running Java 7 be able to use the Apple Java Extensions?
  • Are they included in Java 7, and if not, can I download them to bundle into my app?
  • Are there any alternatives to these extensions that are Java 7 compatible?

回答1:


Will a Mac running Java 7 be able to use the Apple Java Extensions?

Yes. They are included both in the Oracle distribution and in OpenJDK. See the second answer here below.

I can't vouch for the complete API as I only need a subset to support drag-drop behaviour on the app icon and on the app frame. I can confirm though this works as expected with OpenJDK 7. No problems on the distribution side either, as the app is on sale on the Mac App Store.

Are they included in Java 7, and if not, can I download them to bundle into my app?

They are included in OpenJDK 7, you can find the sources in /src/macosx/classes/com/apple and supported by Oracle as hinted by the messages and bug fixes readable on the macosx-port-dev mailing list.

They are also included in the Oracle distribution, unjar rt.jar to see them.

You don't have to download anything, just start using them in your editor:

Are there any alternatives to these extensions that are Java 7 compatible?

Not that I know of, but I doubt you need an alternative.



来源:https://stackoverflow.com/questions/15048220/can-java-7-use-apple-java-extensions

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!