Skip to main content

Running a GroovyFX application from Ant

Althoug an extremely efficient for implementation of UI in Java, GroovyFX (the Groovy wrapper for JavaFX 2.0) is hard to run on command line (e.g., via Ant).
The only straightforward way of running it I was able to find is just to compile all the Groovy sources using groovyc Ant task and then to run the Java class corresponding to the main Groovy script. In this case, all the Groovy jars, the JavaFX runtime jar, and the GroovyFX jar have to be on the classpath.
Moreover, it is extremely important that you run the final Java task using fork=”true”, otherwise you will get strange exceptions from the JavaFX runtime.
For a practical example of the Ant script running such an application, see the build.xml at
I wasn’t able to make it work just by running it as a regular groovy script (without compilation etc.).
What is your experience?


  1. Thank you for this post and I go through almost all of these post. I have known many things over here hence thank you for this share. View at custom essay writing service page if you are interesting on online essay services.


Post a Comment

Popular posts from this blog

Testing in Java

I would like to share a couple of useful tips and links for (unit) testing in Java (focusing on jUnit): To have your code testable, it is a good idea to use dependency injection (e.g., all the critical references are passed in the constructor)To test such a highly decomposed code, it is very convenient to use some mock-up library. I have been really pleasantly surprised by mockito ( It is really easy to create your mocks and the unit tests are then so much easier to write (and can be so much more fine-grained) - I definitely recommend to check it out.
<dependency> <groupId>org.mockito</groupId> <artifactId>mockito-all</artifactId> <version>1.9.5</version> </dependency> For testing System calls, I like to use SystemRules for jUnit (
<dependency> <groupId>com.github.stefanbirkner</groupId> <artifactId>system-rules</art…