Wednesday, May 9, 2012

Hello, World in JavaFX 2.0

I assume that you have successfully set up Eclipse IDE for the development of JavaFX 2.0 applications. If you didn't, please check out Getting Started with JavaFX 2.0 in Eclipse IDE again. If again you can't set it up successfully , please let me know by leaving a comment. NRMYFKP763F5 As mentioned in the previous blog post, we will start our journey by writing "Hello, World" example. Our Hello, World will have one button and one label. When the user click on the button, it will set some text for label. You can look at the image above and see how our program will look in the end.
Hello World JavaFX 2.0
Hello, World in JavaFX 2.0

Follow these steps for creating project:

  • Open Eclipse IDE
  • Create a new Project and specify name
  • Create class with name HelloWorld
  • Add jfxrt.jar file 
  • Copy code of our Hello World application below
If you still have problem with creating the project and setting up Eclipse IDE for development JavaFX 2.0 applications take a look at Getting Started with JavaFX 2.0 in Eclipse IDE.

Here is full code of "Hello, World" application. 

Check out next tutorial, its about JavaFX 2.0 HBox Layout.

If you have any comments, questions, and anything like that, please feel free to a leave comment below, or at least if you like this tutorial you can SHARE it with your friends.

If you like this, and other JavaFX 2 tutorials on this blog, you can follow me on Twitter to be informed about new JavaFX tutorials.


  1. Thank you, Zoran !

    Paul Sidewalk

  2. Hi Zoran,

    Worked perfectly here, but as a newbie in Java, would be wonderful for me if the lines are commented to explain what each does. I'm C++ programmer and this code seem no to be so clear for me at first time.

    Great Work man!