I am trying to run a
jar file that is using
sudo java -classpath /opt/pi4j/lib/pi4j-core.jar -jar Test.jar test.Main
Problem is I keep getting this error
Exception in thread "main" java.lang.NoClassDefFoundError: com/pi4j/io/gpio/GpioFactory
Caused by: java.lang.ClassNotFoundException: com.pi4j.io.gpio.GpioFactory
... 1 more
I don't see why the link isn't being made properly.
I have never done it in command line. But this worked for me: in IntelliJ, I added the pi4J jar files to my project as modules. I then made an artifact and got IntelliJ to create a jar file for me (with all the dependencies including pi4J). Then I transferred the jar file to the pi and it ran fine.