JAVAFX and Raspberry PI B

David Hill David.Hill at Oracle.com
Fri Sep 12 15:21:49 UTC 2014


On 9/12/14, 10:36 AM, Francisco Javier Godino wrote:
> Hello:
>
> I installed Oracle Java SE 8 JDK for Linux ARMV6/7 on Raspberry PI using Oracle indications.
>
> http://www.oracle.com/webfolder/technetwork/tutorials/obe/java/RaspberryPiFX/raspberryfx.html#overview
Are you sure you are getting the right JRE ? (Are you running with a full path to java).
The problem is that you are not finding the class javafx/fxml/FXMLLoader which should be part of the 8.0 and 8u6 JDK.
I probably would have recommended using the instructions at:
     https://wiki.openjdk.java.net/display/OpenJFX/OpenJFX+on+the+Raspberry+Pi
because I helped edit those :-)

The JDK mentioned in the tutorial link is pretty old, it refers to an early access version. The web link above refers to the current released version.

As you may know there are two versions of the JDK for ARM.
The one available for public download should be a full JRE and FXML should just work.

Java SE Embedded (which allows you to subset the JRE) required 'compact2' to support FXML. This is the commercial version not available for public download. compact1 does not have XML support in the JRE and so the FXML classes may fail to load because they cannot resolve dependencies.
>
> I created an application to run on it and I have an issue loading FXML.
>
> The code is:
>
> private Initializable replaceSceneContent(String fxml) throws Exception {
>
>          Locale locale = new Locale("es", "ES");
>          ResourceBundle rb = ResourceBundle.getBundle("internacionalizacion.lang",locale) ;
>
>          FXMLLoader loader = new FXMLLoader();
>          InputStream in = Main.class.getResourceAsStream(fxml);
>          loader.setBuilderFactory(new JavaFXBuilderFactory());
>          loader.setLocation(Main.class.getResource(fxml));
>          loader.setResources(rb);
>
>          AnchorPane page;
>          try {
>              page = (AnchorPane) loader.load(in);
>          } finally {
>              in.close();
>          }
>          Scene scene = new Scene(page, stage.getWidth(),stage.getHeight()-50);
>          stage.setScene(scene);
>          return (Initializable) loader.getController();
>      }
>
> java.lang.reflect.InvocationTargetException
>          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>          at java.lang.reflect.Method.invoke(Method.java:483)
>          at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:367)
>          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>          at java.lang.reflect.Method.invoke(Method.java:483)
>          at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:300)
>          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>          at java.lang.reflect.Method.invoke(Method.java:483)
>          at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
> Caused by: java.lang.RuntimeException: Exception in Application start method
>          at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:894)
>          at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:56)
>          at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:158)
>          at java.lang.Thread.run(Thread.java:745)
> Caused by: java.lang.NoClassDefFoundError: javafx/fxml/FXMLLoader
>          at startup.Main.replaceSceneContent(Main.java:273)
>          at startup.Main.gotoPantallaPrincipal(Main.java:209)
>          at startup.Main.start(Main.java:180)
>          at com.sun.javafx.application.LauncherImpl$8.run(LauncherImpl.java:837)
>          at com.sun.javafx.application.PlatformImpl$7.run(PlatformImpl.java:335)
>          at com.sun.javafx.application.PlatformImpl$6$1.run(PlatformImpl.java:301)
>          at com.sun.javafx.application.PlatformImpl$6$1.run(PlatformImpl.java:298)
>          at java.security.AccessController.doPrivileged(Native Method)
>          at com.sun.javafx.application.PlatformImpl$6.run(PlatformImpl.java:298)
>          at com.sun.glass.ui.lens.LensApplication$RunnableEvent.dispatch(LensApplication.java:182)
>          at com.sun.glass.ui.lens.LensApplication._runLoop(LensApplication.java:860)
>          at com.sun.glass.ui.lens.LensApplication.access$1800(LensApplication.java:58)
>          at com.sun.glass.ui.lens.LensApplication$4.run(LensApplication.java:917)
>          ... 1 more
>
>
> Do I need install anything else?
>
> Thanks
>
> Francisco


-- 
David Hill<David.Hill at Oracle.com>
Java Embedded Development

"A man's feet should be planted in his country, but his eyes should survey the world."
-- George Santayana (1863 - 1952)



More information about the openjfx-dev mailing list