Skip to content
Using the Badass JLink Plugin with log4j2 and JavaFX
Java
Branch: master
Clone or download
Latest commit d503a21 Dec 14, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
gradle/wrapper initial commit Dec 14, 2018
src/main
.gitattributes
.gitignore
.travis.yml initial commit Dec 14, 2018
LICENSE
README.md initial commit Dec 14, 2018
build.gradle initial commit Dec 14, 2018
gradlew initial commit Dec 14, 2018
gradlew.bat initial commit Dec 14, 2018
settings.gradle initial commit Dec 14, 2018

README.md

PRs Welcome License Build Status

Badass JLink Plugin Example: log4j2 and JavaFX

A small JavaFX application using log4j2 that shows how to use the Badass JLink Plugin.

The plugin is configured in build.gradle as follows:

plugins {
    id 'application'
    id 'org.openjfx.javafxplugin' version '0.0.5'
    id 'org.beryx.jlink' version '2.1.9'
}

repositories {
    mavenCentral()
}

dependencies {
    compile 'org.apache.logging.log4j:log4j-core:2.11.1'
}

javafx {
    modules = ['javafx.controls']
}

mainClassName = "hellofx/org.openjfx.HelloFX"

jlink {
    options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
    launcher {
        name = 'helloFX'
    }
    forceMerge('log4j-api')
}

Usage

Running with gradle:

./gradlew run

A window containing the text HelloFX should appear on the screen and the following text should be printed on the console:

[JavaFX Application Thread] INFO  org.openjfx.HelloFX - hellofx!

Creating and executing a custom runtime image:

./gradlew jlink
cd build/image/bin
./helloFX

A window containing the text HelloFX should appear on the screen and the following text should be printed on the console:

[JavaFX Application Thread] INFO  org.openjfx.HelloFX - hellofx!
You can’t perform that action at this time.