Java · JavaFX · Topic 2
How to Set Up JavaFX Using Eclipse and IntelliJ IDEA
Choose Eclipse or IntelliJ IDEA and follow a separate, complete setup path for JDK 27, JavaFX 27, Scene Builder, FXML, and a working Windows application.
Choose one setup path
Eclipse or IntelliJ IDEA
Each tab is independent. Follow only the instructions for the IDE you use.
Eclipse Setup
Step 1 of 12
2.1 Recommended Downloads
Download each required component from its official publisher.
Software downloads
| Software | What to download | Official link |
|---|---|---|
| JDK 27 | Windows x64 .exe installer | Downloaddownload.oracle.com |
| JavaFX 27.0.1 | Windows x64 SDK ZIP | Downloaddownload2.gluonhq.com |
| Eclipse IDE | Current Eclipse IDE release with Java 27 support | Downloadwww.eclipse.org |
| Scene Builder | Windows .msi installer | Downloadgluonhq.com |
| e(fx)clipse | Eclipse Marketplace plugin | Downloadmarketplace.eclipse.org |
Check your understanding: Which JavaFX download contains the lib folder needed by Eclipse?
The Windows x64 JavaFX SDK ZIP.
Step 2 of 12
2.2 Install JDK 27
Install the Java development kit and verify both runtime and compiler commands.
Installation steps
- Download the Windows x64 .exe installer from the official JDK card.
- Double-click the installer and complete the wizard.
- Open Command Prompt after installation.
- Run both verification commands shown below.
java -version
javac -versionCheck your understanding: Which two commands verify that the runtime and compiler are available?
java -version and javac -version.
Step 3 of 12
2.3 Install Eclipse
Install and open the Java Developers edition of Eclipse.
Installation steps
- Download Eclipse from the official Eclipse card.
- Run the Eclipse Installer.
- Select Eclipse IDE for Java Developers.
- Choose an installation directory and finish installation.
- Launch Eclipse and select a workspace folder.
Check your understanding: Which Eclipse package should students select?
Eclipse IDE for Java Developers.
Step 4 of 12
2.4 Install e(fx)clipse
Add JavaFX-aware tooling to Eclipse through Marketplace.
Marketplace steps
- Open Eclipse.
- Select Help → Eclipse Marketplace…
- Search for e(fx)clipse.
- Find the JavaFX tooling package and click Install.
- Accept the prompts and restart Eclipse.
- After restarting, verify that JavaFX-related tooling is available.
Check your understanding: Does e(fx)clipse replace the JavaFX SDK?
No. It adds IDE tooling; students must also download and configure the JavaFX SDK.
Step 5 of 12
2.5 Install Scene Builder
Install the visual FXML editor and verify that it opens.
Installation steps
- Download the Windows .msi installer from the official Scene Builder card.
- Double-click the installer and complete the wizard.
- Open Scene Builder from the Windows Start menu.
- Verify that the application launches.
Check your understanding: What kind of file does Scene Builder save for the JavaFX interface?
An FXML file.
Step 6 of 12
2.6 Register JDK 27 in Eclipse
Configure Eclipse to use the installed JDK rather than an older runtime.
Eclipse configuration
- Go to Window → Preferences → Java → Installed JREs.
- Click Add → Standard VM → Next.
- Browse to the JDK 27 installation directory.
- Click Finish.
- Select JDK 27 as the default.
- Click Apply and Close.
Check your understanding: Should Eclipse be pointed to the JDK root or its bin folder?
The JDK root directory, not the bin folder.
Step 7 of 12
2.7 Extract and Configure JavaFX 27
Create an Eclipse User Library from every JAR in the JavaFX SDK lib folder.
SDK and User Library steps
- Download the Windows x64 JavaFX SDK ZIP.
- Extract it to a permanent folder such as C:\Java\javafx-sdk-27.0.1.
- In Eclipse, open Window → Preferences → Java → Build Path → User Libraries.
- Click New… and enter JavaFX27.
- Select JavaFX27 and click Add External JARs….
- Open the extracted SDK lib directory, select all .jar files, and click Open.
- Click Apply and Close.
C:\Java\javafx-sdk-27.0.1
└── lib
├── javafx.base.jar
├── javafx.controls.jar
├── javafx.fxml.jar
├── javafx.graphics.jar
└── ...Check your understanding: Which SDK folder contains the JavaFX JAR files?
The lib folder.
Step 8 of 12
2.8 Configure Scene Builder in Eclipse
Connect Eclipse JavaFX tooling to Scene Builder and the JavaFX SDK.
Preference settings
- Open Window → Preferences → JavaFX.
- Set the Scene Builder executable to the installed SceneBuilder.exe.
- If available, set JavaFX 11+ SDK to the JavaFX SDK root directory.
- Click Apply and Close.
Check your understanding: When Eclipse requests the JavaFX SDK root, should you select lib?
No. Select the folder that contains lib.
Step 9 of 12
2.9 Create a JavaFX Project
Create a simple non-modular Java project and attach the JavaFX27 library.
Project steps
- Select File → New → Java Project.
- Enter StudentFX as the project name.
- Select JDK 27 as the project JRE.
- Finish the project and leave module-info.java unchecked if prompted.
- Right-click the project → Properties → Java Build Path → Libraries.
- Add the JavaFX27 User Library and configure its JavaFX JARs consistently on the Modulepath.
- Confirm that the project uses JDK 27.
Check your understanding: Should module-info.java be created for this introductory project?
No. Leave it unchecked for this non-modular project.
Step 10 of 12
2.10 Configure VM Arguments
Tell the Java launcher where the JavaFX modules are located and which modules to enable.
Run configuration steps
- Select Run → Run Configurations….
- Choose Java Application and create or select the configuration for the main class.
- On the JRE tab, select JDK 27.
- Open the Arguments tab.
- Paste the VM arguments shown below.
- Leave Program arguments empty and click Apply.
--module-path "C:\Java\javafx-sdk-27.0.1\lib" --add-modules javafx.controls,javafx.fxml --enable-native-access=javafx.graphicsCheck your understanding: Where are these options entered in Eclipse?
Run Configurations → Java Application → Arguments → VM arguments.
Step 11 of 12
2.11 Create Main.java and MainView.fxml
Build a complete JavaFX program that loads an FXML layout.
Create the files
- Under src, create a package named application.
- Create Main.java inside the package.
- Create MainView.fxml inside the same package.
- Open MainView.fxml with Scene Builder using Open With → Scene Builder, or open it directly in Scene Builder.
- Save the FXML file after designing the interface.
package application;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class Main extends Application {
@Override
public void start(Stage stage) throws Exception {
Parent root = FXMLLoader.load(
getClass().getResource("MainView.fxml"));
stage.setTitle("StudentFX");
stage.setScene(new Scene(root, 420, 220));
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.VBox?>
<VBox alignment="CENTER" spacing="14.0"
xmlns="http://javafx.com/javafx/27"
xmlns:fx="http://javafx.com/fxml/1">
<padding><Insets top="24" right="24" bottom="24" left="24"/></padding>
<Label text="JavaFX is configured successfully!"/>
<Button text="Ready to Learn"/>
</VBox>Check your understanding: Which class loads an FXML file?
FXMLLoader.
Step 12 of 12
2.12 Run and Verify the Application
Launch the program and diagnose the result using a final checklist.
Run the application
- Save Main.java and MainView.fxml.
- Ensure Main.java loads MainView.fxml using FXMLLoader.
- Right-click Main.java → Run As → Java Application.
- Verify that the designed window and controls appear.
// Run application.Main using the configured VM arguments.
// The interface is loaded from MainView.fxml.A 420 x 220 window opens.
Title: StudentFX
Content: "JavaFX is configured successfully!"
Button: "Ready to Learn"Check your understanding: What visible result proves that JavaFX and FXML are configured correctly?
The StudentFX window opens and displays the controls defined in MainView.fxml.
IntelliJ IDEA Setup
Step 1 of 12
2.1 Recommended Downloads
Download the IntelliJ setup components only from their official publishers.
IntelliJ IDEA setup downloads
| Software | What to download | Official link |
|---|---|---|
| JDK 27 | Windows x64 .exe installer | Downloaddownload.oracle.com |
| IntelliJ IDEA 2026.2.3 | Current Windows installer | Downloadwww.jetbrains.com |
| JavaFX 27.0.1 | Windows x64 SDK ZIP | Downloaddownload2.gluonhq.com |
| Scene Builder 26.0.0 | Latest stable Windows .msi installer | Downloadgluonhq.com |
| IntelliJ JavaFX Guide | Official JavaFX project documentation | Downloadwww.jetbrains.com |
Check your understanding: Does IntelliJ IDEA include JavaFX in JDK 27?
No. JavaFX is configured separately; Maven can download its libraries for the project.
Step 2 of 12
2.2 Install and Verify JDK 27
Install Oracle JDK 27 and confirm that both Java commands are available.
Installation steps
- Download the Windows x64 .exe installer from the JDK 27 row.
- Run the installer and complete its wizard.
- Open a new Command Prompt window.
- Run both commands shown below.
java -version
javac -versionCheck your understanding: Which commands verify the JDK installation?
java -version and javac -version.
Step 3 of 12
2.3 Install IntelliJ IDEA
Install the current IntelliJ IDEA release and create a workspace for JavaFX projects.
Installation steps
- Open the official IntelliJ IDEA download page.
- Download the Windows installer.
- Run it and accept the recommended launcher and file-association options.
- Start IntelliJ IDEA.
- Complete the first-run prompts and choose a project directory.
Check your understanding: Which IntelliJ edition is required for these JavaFX lessons?
The current unified IntelliJ IDEA installer provides the required core Java features.
Step 4 of 12
2.4 Verify JavaFX Support
Confirm that IntelliJ JavaFX support is enabled before creating the project.
Plugin check
- Open File → Settings, or press Ctrl+Alt+S.
- Select Plugins → Installed.
- Search for JavaFX.
- Enable the bundled JavaFX plugin if it is disabled.
- Restart IntelliJ IDEA if requested.
Check your understanding: Does the IntelliJ JavaFX plugin replace the JavaFX dependencies?
No. The plugin provides IDE tooling; Maven provides the libraries used to build and run.
Step 5 of 12
2.5 Install Scene Builder 26.0.0
Install and test the standalone visual editor used for FXML layouts.
Installation steps
- Open the official Scene Builder download page.
- Choose the Windows Installer (.msi) for Scene Builder 26.0.0.
- Run the installer and finish the wizard.
- Launch Scene Builder once from the Start menu.
- Close it after confirming that the design window opens.
Check your understanding: What does Scene Builder save?
It saves the visual interface as an FXML file.
Step 6 of 12
2.6 Connect Scene Builder to IntelliJ IDEA
Register the actual SceneBuilder.exe location so FXML files can open visually.
Configuration steps
- Open File → Settings.
- Select Languages & Frameworks → JavaFX.
- Beside Path to SceneBuilder, browse to the installed SceneBuilder.exe.
- Click Apply and OK.
- Later, right-click an FXML file and choose Open In SceneBuilder, or use the Scene Builder editor tab when available.
C:\Users\<YourUserName>\AppData\Local\SceneBuilder\SceneBuilder.exeCheck your understanding: Where is the Scene Builder path configured?
File → Settings → Languages & Frameworks → JavaFX.
Step 7 of 12
2.7 Create a Maven JavaFX Project
Create an IntelliJ Maven project that uses JDK 27.
New project steps
- On the Welcome screen, click New Project, or choose File → New → Project.
- Select Java and choose Maven as the build system.
- Name the project JavaFXStudentDemo.
- Choose JDK 27 as the Project SDK.
- Set Group to com.example and Artifact to javafx-student-demo.
- Create the project and wait for Maven import to finish.
Check your understanding: Why is Maven used in this IntelliJ setup?
It downloads and manages the JavaFX libraries and provides a repeatable run command.
Step 8 of 12
2.8 Configure pom.xml for JavaFX 27
Declare JavaFX Controls, FXML, Java 27 compilation, and the JavaFX Maven launcher.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>javafx-student-demo</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.release>27</maven.compiler.release>
<javafx.version>27.0.1</javafx.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>${javafx.version}</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>${javafx.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.14.1</version>
<configuration><release>27</release></configuration>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.8</version>
<configuration><mainClass>com.example.Main</mainClass></configuration>
</plugin>
</plugins>
</build>
</project>After saving
- Click the Maven reload icon when IntelliJ displays it.
- Wait until dependency downloads finish.
- Open the Maven tool window and confirm that the project has no red dependency errors.
Check your understanding: Which two JavaFX modules are required by this FXML example?
javafx-controls and javafx-fxml.
Step 9 of 12
2.9 Create the Java and FXML Files
Place Java classes and FXML resources in the standard Maven folders.
JavaFXStudentDemo
├── pom.xml
└── src/main
├── java/com/example
│ ├── Main.java
│ └── MainController.java
└── resources/com/example
└── MainView.fxmlpackage com.example;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class Main extends Application {
@Override
public void start(Stage stage) throws Exception {
FXMLLoader loader = new FXMLLoader(
Main.class.getResource("MainView.fxml"));
Scene scene = new Scene(loader.load(), 600, 400);
stage.setTitle("JavaFX Student Demo");
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}package com.example;
import javafx.fxml.FXML;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
public class MainController {
@FXML private TextField txtName;
@FXML private Label lblMessage;
@FXML
private void handleClick() {
String name = txtName.getText().trim();
lblMessage.setText(name.isEmpty()
? "Please enter your name."
: "Welcome, " + name + "!");
}
}Check your understanding: Where should MainView.fxml be stored?
src/main/resources/com/example/MainView.fxml.
Step 10 of 12
2.10 Design MainView.fxml
Create the visual layout and connect it to MainController.
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.VBox?>
<VBox xmlns="http://javafx.com/javafx/27"
xmlns:fx="http://javafx.com/fxml/1"
fx:controller="com.example.MainController"
alignment="CENTER" spacing="15">
<padding><Insets top="24" right="24" bottom="24" left="24"/></padding>
<Label text="JavaFX with IntelliJ IDEA"/>
<TextField fx:id="txtName" promptText="Enter your name" maxWidth="240"/>
<Button text="Show Message" onAction="#handleClick"/>
<Label fx:id="lblMessage"/>
</VBox>Open it visually
- Right-click MainView.fxml in the Project panel.
- Choose Open In SceneBuilder, or select the Scene Builder editor tab if shown.
- Drag or arrange the controls.
- Keep Controller class as com.example.MainController.
- Save the FXML file before returning to IntelliJ.
Check your understanding: Which FXML attribute connects the root layout to MainController?
fx:controller="com.example.MainController".
Step 11 of 12
2.11 Run the IntelliJ Application
Run the Maven-configured program and verify the interactive result.
Run from IntelliJ
- Open the Maven tool window.
- Expand Plugins → javafx.
- Double-click javafx:run.
- Alternatively, open IntelliJ Terminal and run the command below.
- Wait for the JavaFX window to appear.
mvn clean javafx:run// Enter "Vatsal" and click Show Message.A 600 x 400 window opens.
Title: JavaFX Student Demo
Input: Vatsal
Message: Welcome, Vatsal!Check your understanding: Which Maven command launches this JavaFX project?
mvn clean javafx:run.
Step 12 of 12
2.12 Troubleshoot the IntelliJ Setup
Identify common Maven, FXML, controller, and Scene Builder configuration errors.
| Error | Likely cause | Solution |
|---|---|---|
| JavaFX runtime components are missing | The Maven run configuration was bypassed | Run Maven javafx:run and confirm the plugin mainClass. |
| Location is required | FXML resource path or filename is wrong | Place MainView.fxml under src/main/resources/com/example and match the case exactly. |
| No controller specified | FXML has handlers but no controller | Set fx:controller="com.example.MainController" on the root. |
| Controller method not found | onAction name differs from the method | Match #handleClick with an @FXML handleClick() method. |
| Scene Builder does not open | Executable path is missing or incorrect | Select the actual SceneBuilder.exe in IntelliJ JavaFX settings. |
| Maven dependencies unresolved | Import or download did not complete | Reload the Maven project and inspect the Maven error output. |
Final checklist
- Project SDK is JDK 27.
- pom.xml uses compiler release 27 and JavaFX 27.0.1.
- Main.java and MainController.java are under src/main/java/com/example.
- MainView.fxml is under src/main/resources/com/example.
- The FXML controller and event handler names match the Java class.
- Scene Builder points to the installed executable.
- mvn clean javafx:run opens the window.
Check your understanding: What should be checked first when FXMLLoader reports Location is required?
Check that MainView.fxml is in src/main/resources/com/example and that its name matches getResource().