Testing AWT-Swing Applications on Mac OS X

Last edited on

How do I test Java AWT/Swing applications on Mac OS X?

Squish supports Java both for Eclipse/SWT and for AWT/Swing. On Mac OS X however, Eclipse/SWT is Squish's default.

The Mac GUI is provided by two separate incompatible toolkits, Cocoa and Carbon. Carbon is the older one and is used by AWT/Swing; Cocoa is the new one and is used with Eclipse/SWT.

If you need to test Java AWT/Swing applications you must change the default. This is easily done by setting the SQUISH_USE_AWT environment variable to 1, usually via export (when in a command shell):


Then, in the same shell, start the Squish IDE:


Note: This is only applies to Squish for Java on Mac OS X.

For setting this permanently please see Mac OS X Lion no longer recognizes environment.plist? . But keep in mind that when you set it permanently you will have to unset it when you want to test SWT/RCP/Eclipse applications.

So consider creating a shell script instead:


Set the script executable:

cd path/to/script
chmod 644 SquishIDE.sh

Java Applets

To be able to test Java Applets the following configuration must be set in Applications/Utilities/Java Preferences:

Run applets: Within the browser process

Also, to force the use of Safari in 32-bit mode, set the SQUISH_QUIT_SAFARI environment variable to 1.

So, to make Squish work with Java AWT/Swing applications or applets, launch Squish like this in Terminal.app:

open SQUISHDIR/bin/squish.app

Of course, SQUISHDIR must be replaced with the actual path to your Squish installation. You could put these lines in a shell script or simply add the exports to you login profile.

Environment Variables