Re: Apple-specific extensions
Re: Apple-specific extensions
- Subject: Re: Apple-specific extensions
- From: Greg Parker <email@hidden>
- Date: Wed, 13 Feb 2008 13:08:16 -0800
On Feb 13, 2008, at 7:33 AM, James Rome wrote:
Apple has added many Apple-specific extensions to Java. How should
we code so that using them is ignored on other platforms?
(You'll get better answers for Java questions on email@hidden
. This list is x11-users, discussing the X11 Window System on Mac OS X.)
The recommended practice for using Mac-specific extensions in cross-
platform code is to use Java's reflection capabilities to check
whether the Mac-specific classes exist.
The sample code here uses a proxy object to install Mac-specific
handlers. The proxy object checks for the presence of the Mac support,
and silently does nothing on other platforms.
http://developer.apple.com/samplecode/OSXAdapter/
It seems to me that using these is contrary to the "write once, run
anywhere" philosophy of Java in general.
"Write once, run anywhere" tends to lead to "second-class citizen
everywhere". Platforms are different, and the best apps adapt to those
differences. (In practice Mac OS X suffers here compared to some other
platforms, because Sun tends to design Java features with Windows and
Solaris in mind.)
--
Greg Parker email@hidden Runtime Wrangler
_______________________________________________
Do not post admin requests to the list. They will be ignored.
X11-users mailing list (email@hidden)
This email sent to email@hidden