Skip to end of metadata
Go to start of metadata

Quick Start

The following makes it simple to start a griffon project.

Create a Griffon project

Once you have installed Griffon you can use the built-in target for creating new projects:

The target will prompt you for the name of your project and create the project structure below:

Create an Application Model

Make sure you are in the root directory of your project (for argument sake "DemoConsole", a simple script evaluator) by typing

The "create-app" target created a Griffon MVC Triad for you in the models, views, and controllers directory named after the application. Hence you already have a model class DemoConsoleModel in the models directory.

The application model for the quick start is simple: the script to be evaluated and the results of the evaluation. Make sure to paste the following code into your copy of DemoConsoleModel.


Create the Controller Logic

The controller for our quick start app is also simple: throw the contents of the script from the model at a groovy shell. Copy the following code into your controller.


The Griffon framework will inject references to the other portions of the MVC triad if fields named model, view, and controller are present in the model or controller. This allows us to access the view widgets and the model data if needed

The executeScript method will be used in the view for the button action. Hence the ActionEvent parameter, and the default value so it can be called without an action event.

Finally, the Griffon framework can be configured to inject portions of the builders it uses. By default, the Threading classes are injected into the controller, allowing the use of the edt, doOutside and doLater methods from the SwingBuilder.

Also, the threading may look a bit obsessive. But good thread management is essential to a well functioning Swing application.

Add Content to the View

The view classes contain the visual components for your application. As with the previous artifacts, copy the contents of the following snippet into its corresponding file: DemoConsoleView.


The view script is a fairly straightforward SwingBuilder script. Griffon will execute these groovy scripts in context of it's UberBuilder (a composite of the SwingBuilder and whatever else is thrown in).

Run the Application

To start your Griffon app run the following target

This will run the application as a Java application. You can also use the run-webstart target to run the application from a WebStart/JNLP file.

The run-app script implies the execution of the package script. The package script creates file artifacts suitable for a Java application, a WebStart application, and an Applet, with code signed by a self-signed certificate. All from the same source tree. By default they go in the 'staging' directory.

Try out the applet by bringing up the applet.html file in a browser. Or you can try them out directly by running the following commands

What's Next

This is just the first pass at the framework. The sky's the limit! More information about the framework, artifacts, conventions and commands can be found at the Griffon Guide.

  • No labels


  1. Trying to follow the instructions above but it doesn't work. 

    I can "create-app" in Griffon but not "run-app" in Griffon. I get a class not found error.

     I like Groovy and I need to make a Desktop application. 

    So I download Griffon 0.9 and it installs

    fine and when I go thru the quick start I type in:

          Griffon create-app

    and then it prompts me for a name - I put in tom3 as a name. 

    Then Griffon successfully creates my directory D:\griffon\tom3. As per the

    quick start I cd to that directory.

    Here the wheels fall off. I type in: Griffon run-app and I get this:


    D:\griffon\tom3>griffon run-app
    Welcome to Griffon 0.9 -
    Licensed under Apache Standard License 2.0
    Griffon home is set to: d:\griffon-0.9
    Base Directory: D:\griffon\tom3
    Resolving dependencies...
    Dependencies resolved in 625ms.
    Running script d:\griffon-0.9\scripts\RunApp.groovy
    Environment set to development
      [groovyc] Compiling 3 source files to C:\Documents and Settings\Administrator\
      [groovyc] Compiling 2 source files to C:\Documents and Settings\Administrator\
         [copy] Copying 1 file to C:\Documents and Settings\Administrator\.griffon\0
         [copy] Copying 1 file to C:\Documents and Settings\Administrator\.griffon\0
         [copy] Copying 1 file to D:\griffon\tom3\staging
         [copy] Copying 1 file to D:\griffon\tom3\staging
    java.lang.NoClassDefFoundError: Files\Java\jdk1/6/0_20\bin;/;C:\WINDOWS\Sun\Java
    Caused by: java.lang.ClassNotFoundException: Files\Java\jdk1.6.0_20\bin;.;C:\WIN
            at Method)
            at java.lang.ClassLoader.loadClass(
            at sun.misc.Launcher$AppClassLoader.loadClass(
            at java.lang.ClassLoader.loadClass(
    Could not find the main class: Files\Java\jdk1.6.0_20\bin;.;C:\WINDOWS\Sun\Java\
    bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Program.  Program will exit.
    Exception in thread "main"    [delete] Deleting directory D:\griffon\tom3\stagin


    What I find odd here is the reference to "windows64". I don't have Windows 64, I have Windows XP Pro (32bit).

    Further, my Java is at the normal Windows position C:\Program Files\Java\Java\jdk1.6.0_20 but the listing

    above doesn't mention that path and there is this strange reference to C:\Program which looks like a truncation

    of Program Files.

    Tom Hite

  2. This page isn't clear. What do you do after the command 'griffon create-app'? It seems you 'cd DemoConsole'. I did that and that works. But then what? What do you type in next? 'griffon run-app' seems to be the next thing you do but that doesn't work on Windows XP with griffon versions 0.3.1, 0.9, 0.9.1, 0.9.2(beta). I get a class not found error. So what is the missing instruction?

  3. Hi Tom,

    I believe you stumbled upon when running with Griffon 0.9. Our primary development platforms are Linux and MacOSX, this is why we missed the problems on Windows at first. I added a couple hints more on what to do on this page. You basically need to copy and paste the snippets shown into their respective files then execute the run-app command. I'd recommend you to visit the Griffon Guide to learn more about what you can do with the framework.


  4. Just like to point out that this "Quick Start" is broken in Groovy 0.9.3.  Apparently, it will be fixed in .9.4, but until then, you can't create projects that start with an uppercase name, when asked for an application name you must put 'demoConsole' in this example to get it to work.