Written by Waseef Khan, JetBrains Campus Ambassador.
This guide gets the KCL Tech Academy Workshop 1 game running in IntelliJ IDEA. If you’re setting up your own JavaFX project, install the tools in step 1 and then open Build a JavaFX app from scratch.
New to Java? The slides and source code from Weeks 1–6 are available on the KCL Tech Academy Java Workshop page.
JetBrains, the company behind IntelliJ IDEA, is a year-long sponsor of KCL Tech. We love working with them and appreciate their support for our student community.
1. Install IntelliJ IDEA and JDK 21
We used BlueJ in the first six weeks to learn Java. Its object bench lets you create objects, call their methods and see the values they hold. We’re moving to IntelliJ IDEA for the game workshop because it can open our Maven project and run it from inside the editor.
IntelliJ IDEA is JetBrains’ integrated development environment (IDE). It puts your project files, code editor and tools for running and debugging Java in one app. For example, you can pause the game on the line that moves the player and check the player’s position.
-
Download and install JDK 21. The Java Development Kit includes the compiler that turns
.javafiles into.classfiles and the runtime that executes them.- On a Mac, check Apple menu → About This Mac. Choose AArch64 for an Apple chip or x64 for Intel.
- On Windows, match the download to Settings → System → About → System type.
Download IntelliJ IDEA and open it. The free Java features cover this workshop.
Eligible students can apply for the free JetBrains Student Pack with a university email address to get IntelliJ IDEA Ultimate and other JetBrains IDEs for educational use.
2. Open the workshop starter
- Download the whole
workshop-01-studentfolder from the Workshop 1 files. If you get a ZIP, extract it first. - Choose Open on IntelliJ’s welcome screen, or File → Open if it’s already open. Select
pom.xmlnext to thesrcfolder. Choose Open as Project if prompted. If IntelliJ asks whether you trust it, choose Trust Project once you’ve checked that it’s the workshop download. - Wait for IntelliJ to load the project. The Project panel on the left should show
pom.xmlandsrc/main/java, where the Java code lives. If the panel is hidden, open View → Tool Windows → Project.
What does pom.xml do?
Maven is the tool that builds the project and downloads the libraries the code needs. It reads those instructions from pom.xml. POM stands for Project Object Model. It’s a settings file written in XML, where tags such as <dependencies> group related settings.
In the starter, pom.xml tells Maven to target Java 21, fetch JavaFX 21.0.6 and use SandboxGame as the class that starts the game. JavaFX is the Java library we use to open the window, draw the world and respond to key presses. When you open the POM as a project, IntelliJ picks up the settings the workshop already provides.
3. Set both Java settings to 21
IntelliJ has one Java setting for the project and another for running Maven. They should both point to JDK 21.
- Open File → Project Structure → Project. Set Project SDK to JDK 21. If it’s missing, choose Add JDK from Disk and select the folder where you installed it. The SDK selector also has a Download JDK option.
- Open Settings → Build, Execution, Deployment → Build Tools → Maven. On a Mac, Settings is in the IntelliJ IDEA menu. Keep Bundled as the Maven home to use the copy that comes with IntelliJ.
- Under Maven → Runner, set JRE to Project SDK so Maven uses the same JDK 21. You can also select JDK 21 directly.
Project Structure → Project. Select JDK 21 in the SDK field.
Maven → Runner. Select Project SDK or JDK 21 in the JRE field.
Copyright © 2026 JetBrains s.r.o., used with permission. IntelliJ IDEA and the IntelliJ IDEA logo are trademarks of JetBrains s.r.o. JetBrains
4. Run the game
- Open View → Tool Windows → Maven.
- Expand the workshop project, then Plugins → javafx. Double-click
javafx:run.
javafx:run is a task provided by the JavaFX Maven plugin. It compiles the project and starts the game with the JavaFX libraries available. The first run may take a minute while Maven downloads files.
Look for a game window with sky, grass tiles and a player standing still. You’ll add textures and player movement in the workshop exercises.
What if it doesn’t run?
- The Maven tool window is missing. Reopen
pom.xmlas a project and let IntelliJ sync. -
release version 21 not supported. Check Maven → Runner → JRE in step 3. Maven needs to run on JDK 21. -
javafx.*imports are red. Check your internet connection and make sure Maven is online. Use the reimport button in the Maven tool window and look for the first download error if the sync fails. -
JavaFX runtime components are missing. Runjavafx:runfrom the Maven tool window in step 4. That task sets up the JavaFX libraries when your app starts.
Both commands should show a version starting with 21 when the terminal is using JDK 21.
java -version javac -version If you already have Maven installed for your terminal, run mvn -v to see which JDK it’s using. You can run mvn javafx:run from the folder containing pom.xml. If your terminal doesn’t recognise mvn, use the Maven tool window in IntelliJ.
Build a JavaFX app from scratch
Use this example to make a small window of your own after installing IntelliJ and JDK 21 in step 1.
Show the blank-project walkthroughCreate a Maven project
- Choose New Project → Java. Name it
hello-javafx. Set Build system to Maven and select JDK 21. - In Advanced Settings, use
example.setupfor GroupId andhello-javafxfor ArtifactId. These names identify your project to Maven. Leave Add sample code unchecked and click Create.
In your new project, check the Project SDK and Maven Runner settings before running Maven.
Check that plain Java runs
In the Project panel, find src/main/java. If it’s missing, create src, main and java as nested folders and sync Maven. Under src/main/java, create the package example.setup, then create the class Main inside it. A package groups classes. The dots in example.setup correspond to the folders example/setup.
hello-javafx/ ├─ pom.xml └─ src/main/java/ └─ example/setup/ └─ Main.java Paste this into Main.java, then click the green triangle next to main(). The Run panel should print Java is ready.
package example.setup; public class Main { public static void main(String[] args) { System.out.println("Java is ready."); } } Tell Maven what to download and run
Replace your pom.xml with the one below. Here are the sections to look for as you read it.
-
<properties>holds named settings.maven.compiler.releasetargets Java 21 andjavafx.versionstores21.0.6. -
<dependencies>lists the libraries your code uses.javafx-controlsprovides controls likeLabel.${javafx.version}uses the version you set in<properties>. -
<build>configures Maven’s plugins. The JavaFX plugin addsjavafx:run, andmainClasstells it to startexample.setup.HelloJavaFx.
<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>example.setup</groupId> <artifactId>hello-javafx</artifactId> <version>1.0-SNAPSHOT</version> <properties> <maven.compiler.release>21</maven.compiler.release> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <javafx.version>21.0.6</javafx.version> </properties> <dependencies> <dependency> <groupId>org.openjfx</groupId> <artifactId>javafx-controls</artifactId> <version>${javafx.version}</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.13.0</version> </plugin> <plugin> <groupId>org.openjfx</groupId> <artifactId>javafx-maven-plugin</artifactId> <version>0.0.8</version> <configuration> <mainClass>example.setup.HelloJavaFx</mainClass> </configuration> </plugin> </plugins> </build> </project> Click Sync Maven Changes to load your updated POM and download JavaFX. If the prompt disappears, open View → Tool Windows → Maven and use the reimport button. You’ll need an internet connection for the first sync.
Create and open the JavaFX window
Create HelloJavaFx.java next to Main.java in the example.setup package.
package example.setup; import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.scene.layout.StackPane; import javafx.stage.Stage; public class HelloJavaFx extends Application { @Override public void start(Stage stage) { Label message = new Label("JavaFX is ready."); StackPane root = new StackPane(message); Scene scene = new Scene(root, 360, 180); stage.setTitle("JavaFX setup check"); stage.setScene(scene); stage.show(); } public static void main(String[] args) { launch(args); } } Calling launch(args) starts JavaFX. JavaFX then calls start() with a Stage, which is the window. The Scene holds its contents, and the StackPane centres the label. stage.show() opens the window.
In the Maven tool window, expand hello-javafx, then Plugins → javafx, and double-click javafx:run. Look for a window titled JavaFX setup check with the text JavaFX is ready. To try a change, close the window, edit the text in new Label(...) and run it again.
If Maven reports Could not find or load main class, check that HelloJavaFx.java is under src/main/java/example/setup, declares package example.setup; and matches example.setup.HelloJavaFx in the POM.
The console check and the JavaFX window were tested on Windows 11 with JDK 21 and IntelliJ’s bundled Maven.

