wob
Posts: 1
Joined: Tue Oct 01, 2013 2:51 am

pi4j + JavaFX in netbeans

Tue Oct 01, 2013 2:59 am

Hi all,

For the life of me I cannot get the pi4j libraries build in netbeans when running in windows. It will not work when there is a FXML file in the project (more specifically when i add the pi4j-core.jar to the library). I get the following error when it builds:

Code: Select all

jarsigner: unable to sign jar: java.util.zip.ZipException: duplicate entry: META-INF/maven/com.pi4j/pi4j-core/pom.xml
Enter Passphrase for keystore: Enter key password for nb-jfx: 
C:\Users\Wesley\Documents\NetBeansProjects\GPIOTest\nbproject\jfx-impl.xml:1346: The following error occurred while executing this line:
C:\Users\Wesley\Documents\NetBeansProjects\GPIOTest\nbproject\jfx-impl.xml:2408: The following error occurred while executing this line:
C:\Users\Wesley\Documents\NetBeansProjects\GPIOTest\nbproject\jfx-impl.xml:1674: jarsigner returned: 1
BUILD FAILED (total time: 16 seconds)
Could someone please walk me through a work around for this? I do not have much experience in dealing with the java signing procedure. From looking it up online I found some posts saying it is trying to sign twice in the pom.xml file from mavern...but could not confirm this, and dont know how to fix that regardless.

Thanks in advance for the help!

douglasjunior
Posts: 2
Joined: Thu Sep 25, 2014 12:25 pm

Re: pi4j + JavaFX in netbeans

Thu Sep 25, 2014 12:31 pm

Same problem here.

If I add the pi4j-core.jar library in the project, I have the exception:

Code: Select all

pi@raspberrypi:~/Downloads$ sudo java -jar TesteRaspberryPi.jar 
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 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 testeraspberrypi.TesteRaspberryPi.start(TesteRaspberryPi.java:30)
        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
Caused by: java.lang.ClassNotFoundException: javafx.fxml.FXMLLoader
        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)
        ... 12 more
I'm using Raspibian and Java8.

douglasjunior
Posts: 2
Joined: Thu Sep 25, 2014 12:25 pm

Re: pi4j + JavaFX in netbeans

Thu Sep 25, 2014 4:56 pm

I think I solved the problem.

Worked by running this command:

Code: Select all

sudo java -Djavafx.platform=eglfb -classpath .:classes:lib/pi4j-core.jar:TesteRaspberryPi.jar testeraspberrypi.TesteRaspberryPi
Before I was using:

Code: Select all

sudo java -jar TesteRaspberryPi.jar
Thank you

Return to “Java”