I have an app which uses some simple JavaFX classes. I'm under the impression that java 8 is supposed to include these classes by default. However when I run a very simple test on my Raspberry Pi running oracle-java8-jdk
(just try to create a Media object) I get an error showing the class isn't found. I don't get this error on my PC when attempting to run the same test with the same jar file:
Exception in thread "main" java.lang.NoClassDefFoundError: javafx/scene/media/Media
at test.Test.main(Test.java:12)
Caused by: java.lang.ClassNotFoundException: javafx.scene.media.Media
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 1 more
If I check the java version I have in stalled I shows:
$ java -version
java version "1.8.0"
Java(TM) SE Runtime Environment (build 1.8.0-b132)
Java HotSpot(TM) Client VM (build 25.0-b70, mixed mode)
Have I missed something obveous here? Do I need to do something special to enable these JavaFX classes?
For starters, according to OpenJFX:
JDK 8 EA builds for the Raspberry Pi include full support for hardware accelerated graphics, with everything from the base, graphics, controls and FXML modules. Media and Web modules are not included.
So early access builds, like yours, never included access to media. And it wasn't included in the final release for ARM 1.8.0_06 (8u6).
What's more, in the new release 1.8.0_33, JavaFX is no longer supported and it was removed from the ARM bundled.
Check this question for more details on this. You still will be able to use JavaFX on your Raspberry Pi, but Media is not an option.