4

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?

Adam Paynter
  • 46,244
  • 33
  • 149
  • 164

2 Answers2

9

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.

Scott K.
  • 1,761
  • 15
  • 26
  • That is a much more detailed answer than mine ;) +1 – VonC Jun 11 '09 at 05:32
  • I was afraid it would come to class loading black magic. ;) Thanks for the tip. – Adam Paynter Jun 11 '09 at 11:30
  • Here's a code snippet that might help: http://stackoverflow.com/questions/2706222/create-cross-platform-java-swt-application/3204032#3204032 – Tute Jul 23 '10 at 14:00
  • This answer is now linked from the SWT FAQ: http://stackoverflow.com/questions/2706222/create-cross-platform-java-swt-application/5784073#5784073 – mchr Jun 09 '11 at 15:30
0

To my knowledge, no: those eclipse products are always distributed per platform

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250