Search code examples
gradlejavafxraspberry-pi3java-11javafx-11

How do I run a JavaFX 11 application on a Raspberry Pi?


I have been trying for days now to figure out how to run a JavaFX 11 desktop application I made (using Gradle) on my Raspberry Pi but to no avail.
I have looked at many guides, but most of them use Java 8, or maven, or something else. At this point, I have no idea where to start.

What I have Tried Before

  1. Install bellsoft openjdk11
  2. Download openjfx-11 sdk and unzip
  3. clone my gradle javafx 11 project from github
  4. edit build.gradle to say sdk=/opt/armv6hf-sdk
  5. chmod +x ./gradlew
  6. ./gradlew run

There error I am getting is could not find :javafx.base:. Searched in the following locations: -file:/opt/armv6hf/lib/javafx.base.jar

What am I doing wrong?

Do I clone the GitHub repo to my Pi? Do I build it on my Windows machine and then move it over?

Update It now builds, but I am getting an error about Unable to open DISPLAY I am 90% sure that this is because I am running raspbian lite (no desktop). How can I run my application without running a full desktop enviornment? Is that even possible?


Solution

  • I believe that you have installed the version of Liberica without JavaFX.

    Not too long ago Bell-SW added a "full version" which is found at the bottom of the page.

    Please note that you need the normal and not embedded JDK but I don't see that as an issue.

    Source of links: https://bell-sw.com/pages/java-13.0.2/ and https://bell-sw.com/pages/java-11.0.6/

    I'd recommend JDK 13 unless you have a reason not to use it.