how can I develop Apple Java Extensions on Windows?

前端 未结 5 2014
时光说笑
时光说笑 2020-12-17 18:31

When I do multi-platform testing on Windows it gets annoying that Eclipse shows errors in the project because of the com.apple.eawt code that I have in a special Mac customi

相关标签:
5条回答
  • 2020-12-17 19:20

    I created an updated jar to solve this problem. GitHub source here. It's hosted on maven central

    0 讨论(0)
  • 2020-12-17 19:21

    This looks like it could be what you're after: http://developer.apple.com/mac/library/samplecode/AppleJavaExtensions/

    This is a pluggable jar of stub classes representing the new Apple eAWT and eIO APIs for Java 1.4 on Mac OS X. The purpose of these stubs is to allow for compilation of eAWT- or eIO-referencing code on platforms other than Mac OS X.

    0 讨论(0)
  • 2020-12-17 19:24

    You might be able to use the approach taken in OSXAdapter, the "dynamic implementation [of which] will only be triggered on platforms that actually support the Apple APIs (e.g. Java 1.4 or later on Mac OS X), avoiding any compatibility concerns." A sample application and the adapter itself are available, as mentioned in this article.

    0 讨论(0)
  • 2020-12-17 19:32

    Put the OS X specific code in a separate class.

    In your main code, use reflection to see if one of the Apple classes are present (or a Class.forName), and if so, THEN invoke the separate class above. I cannot remember if you can do that safely just by calling it, or you need to invoke the separate class by reflection too.

    0 讨论(0)
  • 2020-12-17 19:33

    The latest can be downloaded from http://developer.apple.com/library/mac/samplecode/AppleJavaExtensions, click on the "Download Sample" button at the top of the page

    The latest documentation is at

    http://developer.apple.com/library/mac/documentation/Java/Reference/JavaSE6_AppleExtensionsRef/api/index.html?com/apple/eawt/Application.html

    0 讨论(0)
提交回复
热议问题