Proof-of-concept application created with JavaFX as a true "write once, run everywhere". Uses Gluon tools and GitHub actions to build native applications for all platforms.
For more info, check these posts which describe the full flow in detail:
- Building native applications for all PC and mobile platforms from a single JavaFX project with Gluon Mobile and GitHub Actions (webtechie.be)
- Use GitHub Actions to automate your Gluon build and release cycle (gluonhq:com)
- The Maven library Resistor calculator as described on "Resistor color codes and calculations as a Java Maven library". and "Calculating resistor value with a JavaFX application".
- Existing JavaFX project of my book "Getting started with Java on Raspberry Pi", which contains a JavaFX application for desktop only: "Example application: visualize the Raspberry Pi pins with JavaFX"
- Starter application "Gluon Mobile - Multi View Project" with the Gluon plugin in IntelliJ IDEA as described on "Starting a JavaFX Project with Gluon Tools" (foojay.io).
Gluon Mobile Applications are Java applications written in JavaFX. These applications ensure that developers can create high performance, great looking, and cloud connected mobile apps from a single Java code base.
This application is published to the Google Play and Apple App Store from the fork on GluonHQ
The application provides two views.
Please checkout the prerequisites to run this application as a Maven project at the Gluon website.
Note: The following are command line instructions. For IDE specific instructions please checkout IDE documentation of the gluonfx plugin.
These applications can run on the JVM on desktop platforms. To run the application, execute the following command:
mvn gluonfx:run
The same application can also run natively on any targeted OS, including Android, iOS, Linux, Mac and Windows.
To create a native image, execute the following commands (Use sdkman - https://sdkman.io/):
sdk install java 21.0.0.r11-grl
export GRAALVM_HOME=${SDKMAN_CANDIDATES_DIR}/java/21.0.0.r11-grl
echo $GRAALVM_HOME
mvn gluonfx:build gluonfx:run
Note: The above gluonfx commands are target-platform dependent and might change depending on the platform. For more details, please check GluonFX Maven Goals.
Separate GitHub Actions files are included in this repository:
- maven-ios.yml: creates iPhone app, not fully working in this repository as no Apple developer secrets and other required settings are available here. But you can use this as a reference how to set this up.
- maven-macos.yml: creates MacOS executable.
- maven-ubuntu-linux.yml: creates JAR and native Linux x64 application.
- maven-ubuntu-android.yml: creates Android APK application.
- maven-windows.yml: creates Windows x64 executable.
To configure the GluonFX plugin, please checkout the Configuration documentation.
Use Gradle to build native image:
./gradlew build nativeCompile nativeLink
Executable found in build/gluonfx/XXXX/resistor-calculator-app
Here are some helpful links: