JavaFX - Installation Using Netbeans



Apache Netbeans is a free and open source integrated development environment (IDE) to develop applications using Java. And it allows you to create applications using JavaFX.

This chapter demonstrates how to create a JavaFX application in Netbeans. We will be installing the latest versions of both JavaFX SDK and Apache Netbeans.

Setting NetBeans Environment of JavaFX

NetBeans18 provides inbuilt support for JavaFX. On installing this, you can create a JavaFX application without any additional plugins or JAR files. To set up the NetBeans environment, you will need to follow the steps that are given below.

Step 1 − Visit the NetBeans website NetBeans website and click the Download button in order to download the NetBeans software.

NetBeans Download Page

Step 2 − On clicking this button, a file named Apache-NetBeans-18-bin-windows-x64.exe will be downloaded onto your system. Run this file in order to install it. On running this file, a NetBeans installer will start as shown in the following screenshot.

After completion of the configuration, you will see the Welcome Page of the installer.

Step 3 − Click the Next button and proceed with the installation.

NetBeans IDE Installer

Step 4 − The next window holds the NETBEANS IDE 18 license agreement. Read it carefully and accept the agreement by checking the checkbox at “I accept the terms in the license agreement” and then click the Next button.

NetBeans Licenec Agreement

Step 5 − Choose the destination directory where you need the Netbeans 18 to be installed. Furthermore, you can also browse through the directory where Java Development Kit is installed in your system and click on the Next button.

NetBeans Installation Next

Step 6 − Check the Check for Updates box for automatic updates and click the Install button to start the installation.

Click Install Button

Step 7 − The wizard will then start preparing the installation data.

Step 8 − This step starts the installation of NetBeans IDE 18 and it may take a while.

Step 9 − Once the process is complete, click the Finish button to finish the installation.

Installation Complete

Step 10 − Once you launch the NetBeans IDE, you will see the start page as shown in the following screenshot.

Start Page

Step 11 − In the file menu, select New Project… to open the New project wizard as shown in the following screenshot.

NetBeans File

Step 12 − In the New Project wizard, select Java with Ant and click on Next. It starts creating a new Java Application for you.

New Project JavaFX

Step 13 − Select the name of the project and location of the project in the New Java Application window and then click Finish. It creates a sample application with the given name.

Project Name

In this instance, an application with a name SampleJavaApplication is created. Within this application, the NetBeans IDE will generate a Java program with the name SampleJavaApplication.java. As shown in the following screenshot, this program will be created inside NetBeans Source Packages → samplejavaapplication.

samplejavaapplication java

Step 14 − Right-click on the file and select Run Project to run this code as shown in the following screenshot.

Run Project

This automatically created program contains the code which generates a simple JavaFX window having a button with the label Say ‘Hello World’ in it. Every time you click on this button, the string Hello World will be displayed on the console as shown below.

Say Hello World

Note − We will learn about the code in further chapters.

Advertisements