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
I created an updated jar to solve this problem. GitHub source here. It's hosted on maven central
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.
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.
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.
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