Follow the official installation instructions of pi4jp( http://pi4j.com/install.html )Install
curl -s get.pi4j.com | sudo bash
After the installation, the Java program is executed and the following error is reported
At first, I thought it was a problem with wiringpi. After a long time, I found that it was a problem with the version of the pi4j installation package
The default installation is version 1.1. Raspberry Pie 3 needs version 1.2 to run normally, so you need to manually download the 1.2 installation again
Uninstall 1.1 for automatic installation first
curl -s get.pi4j.com/uninstall | sudo bash
install 1.2
wget http://get.pi4j.com/download/pi4j-1.2-SNAPSHOT.deb
Installation
sudo dpkg -i pi4j-1.2-SNAPSHOT.deb
Execute Java again, success