Parufrade
Posts: 3
Joined: Sun Mar 15, 2015 8:52 am

Raspberry Pi 2 Java Project

Sun Mar 15, 2015 8:56 am

I have an JavaFX application that runs perfectly on a normal desktop. I am trying to make it run on a Raspberry Pi 2 (1GB) but I am not able to. I really need some help because I need to use the PI to deploy this application to some costumers.

These are the details and error messages:

Raspberry Pi 2 B

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)

ERRORS:

pi@raspberrypi ~ $ java -jar KangarooAdmin.jar
java.lang.ClassNotFoundException: com.sun.deploy.uitoolkit.impl.fx.HostServicesFactory
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 java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:340)
at com.sun.javafx.application.HostServicesDelegate$1.run(HostServicesDelegate.java:57)
at com.sun.javafx.application.HostServicesDelegate$1.run(HostServicesDelegate.java:46)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.HostServicesDelegate.getInstance(HostServicesDelegate.java:45)
at javafx.application.HostServices.<init>(HostServices.java:52)
at javafx.application.Application.getHostServices(Application.java:323)
at kangarooadmin.KangarooAdmin.start(KangarooAdmin.java:58)
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)
at java.lang.Thread.run(Thread.java:744)
Exception in Application start method
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 com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:305)
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:744)
Caused by: java.lang.NullPointerException
at javafx.application.HostServices.getCodeBase(HostServices.java:67)
at kangarooadmin.KangarooAdmin.start(KangarooAdmin.java:58)
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
Exception running application kangarooadmin.KangarooAdmin

User avatar
DougieLawson
Posts: 39303
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Raspberry Pi 2 Java Project

Sun Mar 15, 2015 12:13 pm

Don't you just love Java stack traces, they so clearly describe the failure, NOT.

You've got a null pointer exception in Kangaroo.Java line #58.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

Parufrade
Posts: 3
Joined: Sun Mar 15, 2015 8:52 am

Re: Raspberry Pi 2 Java Project

Mon Mar 16, 2015 4:56 am

Yes, the stack trace shows that but it is working perfectly on any desktop. It seems that the null pointer error is due to this problem: java.lang.ClassNotFoundException: com.sun.deploy.uitoolkit.impl.fx.HostServicesFactory

As you see, I am using the Java 1.8.0 on Raspberry and it supposed to have JavaFX on it. Does't it?

User avatar
DougieLawson
Posts: 39303
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Raspberry Pi 2 Java Project

Mon Mar 16, 2015 8:25 am

http://www.oracle.com/webfolder/technet ... rryfx.html

Starting from "Building a Basic JavaFX Application" on that page.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

Parufrade
Posts: 3
Joined: Sun Mar 15, 2015 8:52 am

Re: Raspberry Pi 2 Java Project

Mon Mar 16, 2015 2:12 pm

Hello Dougie

I finally solved the problem. Some JavaFX libraries are not included in Java 1.8.0 which came with the PI. I had to remove two of them from my application. Now it is working! Thanks for the help!

Marco
A brazilian living in India!!

abigdreamer
Posts: 1
Joined: Wed Apr 15, 2015 5:57 pm

Re: Raspberry Pi 2 Java Project

Thu Apr 16, 2015 12:46 am

I to want to get Objectwheel running on a Raspberry Pi (2) and would love some advice --- help -- image file -- etc.

Thanks in advance

Mike Tallent
CEO
Objectwheel
mikegps1@gmail.com

Return to “Java”