5

I'm trying to run Esemble8.jar on my new RaspBerry pi. I followed this tutorial: http://www.oracle.com/webfolder/technetwork/tutorials/obe/java/RaspberryPiFX/raspberryfx.html

I was able to install Java8 but when I try to run the Ensemble8.jar (or any other small JavaFx application) I've this error:

Error: Could not find or load main class ensemble.EnsembleApp

My PATH is correct; have you some suggestion to fix the problem?

Thanks!

José Pereda
  • 44,311
  • 7
  • 104
  • 132
drenda
  • 5,846
  • 11
  • 68
  • 141

1 Answers1

15

Since the 8u33 for ARM version, Oracle has removed JavaFX from the ARM distribution, as it was announced here.

You can read some statements about this in these forums:

  • Raspberry Pi Forum (now it's offline)
  • OpenJFX Mailing list

So you won't be able to run any JavaFX application... unless you downgrade your version to the last JDK8u6 that supported JavaFX, or you provide a valid jfxrt.jar.

And you can do it following this tutorial, cross building OpenJFX for ARM, or just using some already built distribution like this one hosted on the JavaFXPorts project.

Once you have downloaded armv6hf-sdk.zip, unzip it and you need to add this command line option to attach this external source to the classpath, with the extension mechanism:

-Djava.ext.dirs=<path to armv6hf-sdk>/rt/lib/ext

For instance, you need this to run one of the JavaFX old samples from its actual path:

sudo /opt/jdk1.8.0_33/bin/java -Djava.ext.dirs=<path to armv6hf-sdk>/rt/lib/ext -jar BrickBreaker.jar
José Pereda
  • 44,311
  • 7
  • 104
  • 132
  • 3
    You may consider installing (copying or symlinking) the contents of `rt/lib/ext` and `rt/lib/ext` directly into your JVM eg: `/opt/jdk1.8.0_33/jre/lib/ext` and `/opt/jdk1.8.0_33/jre/lib/arm` respectively. This will remove the need to run apps with the `-Djava.ext.dirs=/rt/lib/ext` directive – Philip Couling Feb 20 '15 at 12:25
  • 1
    I have tried downloading `armv6hf-sdk.zip` and added it to my project directory. I added 'javafx-mx.jar`, 'jfxrt.jar` and `jfxswt.jar` to my project libraries and in the output directory. However, my pi stil says it can't find the main class. – Joël Abrahams Apr 01 '17 at 13:02
  • 1
    @JoëlAbrahams Check this [question](http://stackoverflow.com/questions/40481455/running-javafx-gui-on-the-raspberry-pi/40483500#40483500) – José Pereda Apr 01 '17 at 13:05
  • If anyone has reached here having same error with JavaFX 11/12 + OpenJdk 14, then below command should help: java --module-path "D:\Software\Java\OpenJdk\Windows\11\JavaFX\javafx-sdk-11.0.2\lib" --add-modules javafx.controls,javafx.fxml,javafx.graphics -jar Ensemble8.jar – Stack2Heap Jun 23 '20 at 16:38