Pi4J / pi4j-v1

DEPRECATED Java I/O library for Raspberry Pi (GPIO, I2C, SPI, UART)
http://www.pi4j.com
Apache License 2.0
1.31k stars 448 forks source link

NoClassDefFoundError com/pi4j/io/gpio/gpiofactory #542

Closed RobinQuante closed 2 years ago

RobinQuante commented 2 years ago

Hello,

i have try to use the pi4j lib to controll my outputs from the Raspberry Pi 4.

But i get yt the Start on my RP the Exeption NoClassDefFoundError com/pi4j/io/gpio/gpiofactory The log points on the first initialition of the Factory. i have a ClassNotFoundExeption for the GpioFactory

can someone help me with this problem?

pom .txt

FDelporte commented 2 years ago

I see in the pom you are using pi4j version 1.2. For the Raspberry Pi 4, please use version 1.3 or 1.4.

You will also need to update WiringPi to be able to access the GPIOs in the right way. For full description, see https://pi4j.com/1.4/install.html

sudo pi4j --wiringpi

RobinQuante commented 2 years ago

i have istall a new Linux on the pi, have install the pi4j with the command from the webside. i have install the new wiringpi with you Command. Update the Version of the dependencies in the pom to 1.4 the Native and device i have deleted.

i still have still the same problem.

FDelporte commented 2 years ago

did you run the program with sudo? if it would be possible to upload your full project to github I can maybe take a look if I can spot the problem...

RobinQuante commented 2 years ago

i have start the Program with sudo java -jar tractor-1.0-SNAPSHOT.jar

i have start the GpioTest.java, it runs without an error.

i have try to upload the code and hope you can see it https://github.com/RobinQuante/AutoDriving/tree/main/AutoDrivingTractor

FDelporte commented 2 years ago

Hey Robin, I've taken a look at your project. Please find attached an updated version. Nice work BTW with the Swing. If you ever want to move to JavaFX, check https://pi4j.com/getting-started/user-interface-with-javafx/ for more info.

Some of the changes:

AutoDrivingTractor.zip