Compiling and using the Java extension example

Last edited on


Support for custom classes that do not follow the AWT/Swing and SWT principles of parent/child hierarchy can be added to Squish for Java using extensions (also see Java Extension API for Custom Widgets).

Compiling the Java extension example

The steps below briefly summarize how to build the CanvasTest example in the SQUISHDIR/examples/java/canvastest directory:

Step #1 - Change to the appropriate directory

cd "path/to/squish/examples/java/canvastest"

For example, using Squish 4.1 on Windows:

cd "C:\Users\MyUser\squish-4.1-java-win32\examples\java\canvastest"

Step #2 - Compile the AUT and the extension classes

On Unix:

javac -cp ".:./classes;path/to/squish/lib/squishjava.jar" -d classes *.java

On Windows:

javac -cp ".;./classes;path/to/squish/lib/squishjava.jar" -d classes *.java

For example, using Squish 4.1 on Windows:

javac -cp ".;./classes;"C:/Users/MyUser/squish-4.1-java-win32/lib/squishjava.jar" -d classes *.java

Step #3 - Generate the AUT jar file with a manifest

jar cfm CanvasTest.jar -C classes CanvasTest.class -C classes MyCanvas.class -C classes MyCanvasGroup.class -C classes MyCanvasItem.class -C classes MyCanvasShape.class -C classes MyCircleCanvasItem.class -C classes MyRectCanvasItem.class

Contents of the AUT jar manifest ( should be:

Main-Class: CanvasTest

Step #4 - Generate the extension jar file with a manifest

jar cfm CanvasExtension.jar -C classes MyCanvasExtension.class -C classes MyCanvasFactory.class -C classes MyCanvasItemExtension.class

Contents of the extension jar manifest ( should be:

Extension: MyCanvasFactory

Using the Java extension example

The final step is to register the extension .ini file:

"path/to/squish/bin/squishserver" --config setConfig CanvasTest.jar "path/to/examples/canvastest/Extension.ini"

For example, using Squish 4.1 on Windows:

"C:\Users\MyUser\squish-4.1-java-win32\bin\squishserver" --config setConfig CanvasTest.jar "C:\Users\MyUser\squish-4.1-java-win32\examples\java\canvastest\Extension.ini"

Contents of extension .ini file:


Now you should be able to start the Squish IDE, launch the CanvasTest example (be sure to to register and use the CanvasTest.jar file as the AUT) and pick the circles and boxes in the CanvasTest example. (If there are any problems, check the Runner/Server Log for relevant error messages.)