title: It is possible to use JavaFX in Groovy using the same syntax as in Java?
body: <p>I am using jdk1.8.0_25.</p>
  
  <p>I am trying to run a JavaFX app file below which, when named 'HelloWorldMain.java', compiles and runs OK with javac/java. I renamed it as 'HelloWorldMain.groovy' and can't run it using Groovy.</p>
  
  <p>Is there a simple way to run this file using Groovy with no or minimal modification, preferably without additional software like GroovyFX? And if I have to use GroovyFX, can I run this pure Java code without modification?</p>
  
  <pre><code>import javafx.application.Application; 
  import javafx.event.ActionEvent; 
  import javafx.event.EventHandler; 
  import javafx.scene.Group; 
  import javafx.scene.Scene; 
  import javafx.scene.control.Button; 
  import javafx.stage.Stage; 
  
  /** 
  * 
  * @author cdea 
  */ 
  public class HelloWorldMain extends Application {
  
  /** 
  * @param args the command line arguments 
  */ 
  public static void main(String[] args) { 
      Application.launch(args); 
  } 
  
  @Override 
  public void start(Stage primaryStage) { 
      primaryStage.setTitle("Hello World"); 
      Group root = new Group(); 
      Scene scene = new Scene(root, 300, 250); 
      Button btn = new Button(); 
      btn.setLayoutX(100); 
      btn.setLayoutY(80); 
      btn.setText("Hello World"); 
      btn.setOnAction(new EventHandler&lt;ActionEvent&gt;() { 
          public void handle(ActionEvent event) { 
              System.out.println("Hello World"); 
          }
      }); 
      root.getChildren().add(btn); 
      primaryStage.setScene(scene); 
      primaryStage.show(); 
  }
  
  }
  </code></pre>
  
  <p>I am trying to run it as</p>
  
  <blockquote>
    <p>groovy HelloWorldMain.groovy</p>
  </blockquote>
  
  <p>and getting the following output in command line:</p>
  
  <pre><code>Caught: java.lang.RuntimeException: java.lang.ClassNotFoundException:             javafx.application.Application$launch
  java.lang.RuntimeException: java.lang.ClassNotFoundException:     javafx.application.Application$launch
          at javafx.application.Application.launch(Application.java:260)
          at javafx.application.Application$launch.call(Unknown Source)
          at HelloWorldMain.main(HelloWorldMain.groovy:20)
  Caused by: java.lang.ClassNotFoundException: javafx.application.Application$launch
          at javafx.application.Application.launch(Application.java:248)
          ... 2 more
  </code></pre>