I tested your problem with both groovyConsole (from groovy -sdk-2.1.0 ) and IntelliJ IDEA 12.0.3. The only exception I got:
Caught: java.lang.NoClassDefFoundError: javafx/application/Application java.lang.NoClassDefFoundError: javafx/application/Application at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120) Caused by: java.lang.ClassNotFoundException: javafx.application.Application ... 1 more
This is because the JavaFX runtime (jfxrt.jar) was not in the classpath. This can be fixed with
mvn com.zenjava:javafx-maven-plugin:1.3:fix-classpath
The above command is taken from the JavaFX Maven Plugin Wiki . You must execute it only once. After that, both groovyConsole and IntelliJ work. I had to restart groovyConsole, this was not necessary for IntelliJ.
Interestingly, I do not see GroovyFx-jar in the External Libraries section. I am using the free version of the IDEA community without any plugins.
Hello World from the GroovyFX main page works out of the box in IDEA, but not in groovyConsole - I also get "java.lang.ClassNotFoundException: groovyx.javafx.GroovyFX". I managed to run it with the following code, but this is not a good solution, since it only works on the first start, then you need to restart groovyConsole:
@GrabConfig(systemClassLoader=true, initContextClassLoader=true) @Grab(group='org.codehaus.groovyfx', module='groovyfx', version='0.3.1') import static groovyx.javafx.GroovyFX.start start { stage(title: 'GroovyFX Hello World', visible: true) { scene(fill: BLACK, width: 500, height: 250) { hbox(padding: 60) { text(text: 'Groovy', font: '80pt sanserif') { fill linearGradient(endX: 0, stops: [PALEGREEN, SEAGREEN]) } text(text: 'FX', font: '80pt sanserif') { fill linearGradient(endX: 0, stops: [CYAN, DODGERBLUE]) effect dropShadow(color: DODGERBLUE, radius: 25, spread: 0.25) } } } } }
I am not sure, but I think the reason for this is the error here . Must be fixed in Groovy 2.2, we will see.