How can I create a JavaFX project without all the folders?

Viewed 50

I remember doing some projects for Computer Science at school some time ago, opening a JavaFX file used to look like this: enter image description here

But now whenever I try to start a JavaFX project, it looks like this: enter image description here

Is there a way I can start up a JavaFX project like the former?

1 Answers

You are using the Idea new JavaFX project wizard.

If you want to have a JavaFX project which is not based on the standard JavaFX project template that Idea provides in its new JavaFX project wizard, then don't use the new JavaFX project wizard.

Instead, create a new empty project.

Then, to set up your environment to build and run JavaFX code, either (more difficult):

  • Follow the "JavaFX and IntelliJ: non-modular from IDE" instructions at openjfx.io.

    • you could instead follow the "modular from IDE" instructions if you prefer, that will need an additional module-info.java file with the appropriate content for your application.

OR (easier):

That said, I advise using the "New JavaFX project wizard" and the standard directory layout. The wizard also integrates your project with a standard build tool (I recommend Maven unless you know and prefer Gradle). There are many advantages to this, especially if you want to share your application code with others.

It is also less error-prone to use the wizard. There are one or two questions on this site every day for people who have tried to manually configure JavaFX builds or deployments in their environment and have been unable to do it without help.

Related