DEV Community

Java Lover
Java Lover

Posted on

How to Set Up JavaFX in IntelliJ IDEA with Maven

There are some options to start working with JavaFX to build Graphical User Interface (GUI) using Java programming language. The documentation has explained the JavaFX installation in various code editors, like NetBeans, Eclipse, Visual Studio Code, and IntelliJ IDEA. The easiest one is to set up JavaFX in IntelliJ IDEA with the Maven project because you don't need to download JavaFX SDK or set up the library.

Per this article published, the newest JavaFX version is 20.0.1 and it needs at least Java JDK 17 to install. Make sure the JDK is added to the System Variable Path and set the JAVA_HOME environment variable. You can go to this article to do all that stuff.

  • After Java 17 was installed, open IntelliJ IDEA and click New Project
  • In the left bar (Generators), choose JavaFX
  • Then, specify Name and Folder Location of your project and change Group and Artifact name
  • The most important part is the SDK, make sure you choose the installed Java JDK version, and click Next
  • In the Additional Libraries window, you can select the libraries you want to work with to simplify JavaFX project development, and click Create

Image description

IntelliJ IDEA will download all dependencies needed, so it will take a while. After finishing, the project structure will look like the following image.

Image description

Open pom.xml file, and make sure there are two main dependencies (javafx-controls and javafx-fxml) and one plugin javafx-maven-plugin. In some cases, those dependencies are not the latest version. You can check the latest version in this link for javafx-controls and this link for javafx-fxml.

Image description

Image description

To test and run the application, open HelloApplication.java file, then click the green color play button. It will show the GUI like the following image.

Image description

Congratulation!!! You succeed in creating the first GUI application using JavaFX framework.

👋 One new thing before you go

Tired of spending so much on your side projects? 😒

We have created a membership program that helps cap your costs so you can build and experiment for less. And we currently have early-bird pricing which makes it an even better value! 🐥

Just one of many great perks of being part of the network ❤️

Top comments (0)

Imagine monitoring actually built for developers

Billboard image

Join Vercel, CrowdStrike, and thousands of other teams that trust Checkly to streamline monitor creation and configuration with Monitoring as Code.

Start Monitoring

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay