Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does SWT distribute a JAR that works on any supported operating system?

Tags:

jar

swt

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?

like image 354
Adam Paynter Avatar asked Jan 23 '23 13:01

Adam Paynter


1 Answers

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.

like image 157
Scott K. Avatar answered Feb 08 '23 14:02

Scott K.