问题
The SWT project currently maintains one distributable for each supported operating system. For example:
swt-3.4.2-win32-win32-x86.zip
swt-3.4.2-gtk-linux-x86.zip
swt-3.4.2-carbon-macosx.zip
Is there a distributable that just Does the Right Thing™, regardless of which operating system the application is running on?
回答1:
No, there isn't, and you can't make one either out of the standalone SWT distributions. That's because each os/windowing system/architecture combination has its own implementation of each of the SWT classes. For example, if your code refers to org.eclipse.swt.widgets.Button, the JVM has no way of knowing if you want the win32, Mac/Carbon or Mac/Cocoa implementation of the class.
You could conceivably do this yourself by writing a loader class that figured out the platform, architecture and windowing system and then loaded the right JAR. Or, architect your application using equinox, and it can load the right SWT plugin for you automatically. But you can't do it with any of the unmodified SWT distributions.
回答2:
To my knowledge, no: those eclipse products are always distributed per platform
来源:https://stackoverflow.com/questions/976400/does-swt-distribute-a-jar-that-works-on-any-supported-operating-system