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!

2
  • Which JDK8 version are you using? Feb 2, 2015 at 18:25
  • root@raspberrypi:~# java -version java version "1.8.0_33" Java(TM) SE Runtime Environment (build 1.8.0_33-b05) Java HotSpot(TM) Client VM (build 25.33-b05, mixed mode)
    – drenda
    Feb 2, 2015 at 18:36

1 Answer 1

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
4
  • 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=<path to armv6hf-sdk>/rt/lib/ext directive Feb 20, 2015 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. Apr 1, 2017 at 13:02
  • 1
    @JoëlAbrahams Check this question Apr 1, 2017 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, 2020 at 16:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.