This is a template project to create a modularized JavaFX application. It uses Gradle for its build and includes The Badass JLink Plugin to create custom runtime images and platform specific applications with bundled runtimes with jpackage.
It includes Logback for logging and it comes with a reasonable default logging configuration that logs to STDOUT and
to a file at the path ${user.home}/app.log
The application is modularized so that slimmed down runtimes can be bundled with the application.
- macOS Warning: When running on macOS, you may see a warning:
Timeout while waiting for app reactivation. This is a known issue with JavaFX on macOS and does not affect the functionality of the application.
- Clone the project with
git clone https://github.com/mjparme/javafx-template.git <name-of-your-project>(or fork it and create a clone of your fork) - Remove the
.gitdirectory so it is no longer tied to this repo - Execute
git init .to put it back under version control - Push to a remote if you want
IntelliJ will happily configure itself from a Gradle build.
- Open IntelliJ
- File -> Open
- In the file chooser dialog select the directory that contains the local repository and press the
Openbutton. IntelliJ will notice the directory has abuild.gradlein it and then do its thing and in a few minutes you should be good to go. - To run it go to
Launcher.javaand press the green arrow in the gutter next to the class name or next to themain()method. Or you can open a terminal and execute./gradlew run
The project includes the Gradle Wrapper so no local installation of Gradle is needed.
./gradlew run-- Pretty self explanatory, will run the application../gradlew jpackage-- Will package your app with a bundled runtime in a platform specific format. After this runs check thebuild/jpacakgedirectory for the bundled runtimes. On a Mac this will be a.dmg,.pkg, and.appfile. On Windows it will be an.exeand.msiI think, and a.rpmfile on linux I think. I have only ever ran this on a Mac so on different platforms just run it and see what you get.