Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I know that Oracle removed JavaFX in 8u33, but I'm wondering why I can't use JavaFX with jdk1.8.0? I got it from the Oracle archives (http://download.oracle.com/otn/java/jdk/8-b132/jdk-8-linux-arm-vfp-hflt.tar.gz)

I have this extracted in /usr/bin/java_8_arm/jdk1.8.0 and am running my .jar file with sudo /usr/bin/java_8_arm/jdk1.8.0/bin/java -jar jarfile.jar

Running /usr/bin/java_8_arm/jdk1.8.0/bin/java -version returns

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)

and running System.out.println("Running Java version: " + Runtime.class.getPackage().getImplementationVersion());

returns Running Java Version: 1.8.0

The error I'm getting is:

Exception in thread "main" java.lang.NoClassDefFoundError: javafx/embed/swing/JFXPanel
    at front_end.GUI.initGUI(GUI.java:47)
    at back_end.Run.main(Run.java:28)
Caused by: java.lang.ClassNotFoundException: javafx.embed.swing.JFXPanel
    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)
    ... 2 more

If you're wondering, I'm programming and compiling the program to a shared file via Windows 7 and running the JAR from a Raspberry Pi.

inb4 "why do you need javafx on a raspberry pi" - to render html, since other java components only support html 3.2. I have tried other renderers. This is the only one I could even get working right on my desktop, let alone the RPi.

Also, I am programming and compiling on 1.8.0 as well.

UPDATE:

As per José Pereda's answer, I have downloaded the JavaFX files and placed them in my original java install (I am now using /usr/bin/jdk8u6/ as my folder, and obviously jdk1.8.0_06).

Here is my install hierarchy, starting from the lib directory:

/usr/bin/jdk8u6/lib/:
arm ext             javafx.properties  jfxswt.jar  tools.jar
ct.sym  ir.idl              jconsole.jar       orb.idl
dt.jar  javafx.platform.properties  jexec          sa-jdi.jar

/usr/bin/jdk8u6/lib/arm:
jli          libgstreamer-lite.so        libjfxmedia.so
libdecora_sse.so     libjavafx_font_freetype.so  libjfxwebkit.so
libfxplugins.so      libjavafx_font_pango.so     libprism_common.so
libglass_monocle.so  libjavafx_font.so       libprism_es2_eglfb.so
libglass_monocle_x11.so  libjavafx_iio.so        libprism_es2_monocle.so
libglass.so      libjawt.so          libprism_sw.so

/usr/bin/jdk8u6/lib/arm/jli:
libjli.so

/usr/bin/jdk8u6/lib/ext:
jfxrt.jar

I still get the same error.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
316 views
Welcome To Ask or Share your Answers For Others

1 Answer

You can download an updated and upgraded version of JavaFX for ARM from here: JavaFX Embedded SDK

Once downloaded on your Raspberry Pi, you'll need to extract and copy the content into your JDK 1.8 (check this link for embedded).

You will be able to run the latest JavaFX version for ARM* on your Pi, including the WebView control.

Also, using the Gluon plugin for your IDE, you'll be able to deploy remotely the project on your Pi as well.

EDIT

*ARM: Note that JavaFX for ARM has never supported Swing. Other features like the WebView and Media weren't supported either, but recently these have been included in Gluon's build.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...