Hello
I want to use pi4j2 as pi4j isn't supported anymore.
I dowloaded https://www.b4x.com/android/forum/threads/pi4j2-raspberry-pi-i-o-library.136113/#content
When I run the simple sample solution from Erel I get :
I updated with sudo apt intstall default.jdk
What could be wrong?
I want to use pi4j2 as pi4j isn't supported anymore.
I dowloaded https://www.b4x.com/android/forum/threads/pi4j2-raspberry-pi-i-o-library.136113/#content
When I run the simple sample solution from Erel I get :
Waiting for debugger to connect...
Program started.
Hello world!!!
Mar 04, 2024 11:49:38 AM com.pi4j.Pi4J newAutoContext
INFO: New auto context
Mar 04, 2024 11:49:38 AM com.pi4j.Pi4J newContextBuilder
INFO: New context builder
Mar 04, 2024 11:49:39 AM com.pi4j.platform.impl.DefaultRuntimePlatforms add
INFO: adding platform to managed platform map [id=raspberrypi; name=RaspberryPi Platform; priority=5; class=com.pi4j.plugin.raspberrypi.platform.RaspberryPiPlatform]
Mar 04, 2024 11:49:40 AM com.pi4j.library.pigpio.util.NativeLibraryLoader load
SEVERE: Unable to load [libpi4j-pigpio.so] using path: [/lib/armhf/libpi4j-pigpio.so]
java.lang.UnsatisfiedLinkError: /tmp/libpi4j-pigpio14386774102354138582.so: libpigpio.so.1: cannot open shared object file: No such file or directory
at java.base/java.lang.ClassLoader$NativeLibrary.load0(Native Method)
at java.base/java.lang.ClassLoader$NativeLibrary.load(ClassLoader.java:2450)
at java.base/java.lang.ClassLoader$NativeLibrary.loadLibrary(ClassLoader.java:2506)
at java.base/java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2705)
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2635)
at java.base/java.lang.Runtime.load0(Runtime.java:768)
at java.base/java.lang.System.load(System.java:1854)
at com.pi4j.library.pigpio.util.NativeLibraryLoader.loadLibraryFromClasspath(NativeLibraryLoader.java:221)
at com.pi4j.library.pigpio.util.NativeLibraryLoader.load(NativeLibraryLoader.java:162)
at com.pi4j.library.pigpi
o.internal.PIGPIO.<clinit>(PIGPIO.java:74)
at com.pi4j.library.pigpio.impl.PiGpioNativeImpl.gpioInitialise(PiGpioNativeImpl.java:91)
at com.pi4j.library.pigpio.PiGpio.initialize(PiGpio.java:146)
at com.pi4j.plugin.pigpio.provider.gpio.digital.PiGpioDigitalInputProviderImpl.create(PiGpioDigitalInputProviderImpl.java:60)
at com.pi4j.plugin.pigpio.provider.gpio.digital.PiGpioDigitalInputProviderImpl.create(PiGpioDigitalInputProviderImpl.java:41)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at com.pi4j.provider.impl.ProviderProxyHandler.invoke(ProviderProxyHandler.java:100)
at com.sun.proxy.$Proxy2.create(Unknown Source)
at com.pi4j.context.Context.create(Context.java:317)
at com.pi4j.internal.IOCrea
tor.create(IOCreator.java:58)
at com.pi4j.internal.IOCreator.create(IOCreator.java:106)
at com.pi4j.internal.IOCreator.create(IOCreator.java:186)
at anywheresoftware.b4j.objects.Pi4JWrapper$DigitalInputWrapper.Intiailize2(Pi4JWrapper.java:47)
at anywheresoftware.b4j.objects.Pi4JWrapper$DigitalInputWrapper.Initialize(Pi4JWrapper.java:44)
at b4j.example.main._start(main.java:83)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:629)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:234)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at j
ava.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:111)
at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:100)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:98)
at b4j.example.main.main(main.java:29)
Error occurred on line: 19 (Main)
java.lang.reflect.UndeclaredThrowableException
at com.sun.proxy.$Proxy2.create(Unknown Source)
at com.pi4j.context.Context.create(Context.java:317)
at com.pi4j.internal.IOCreator.create(IOCreator.java:58)
at com.pi4j.internal.IOCreator.create(IOCreator.java:106)
at com.pi4j.internal.IOCreator.create(IOCreator.java:186)
at anywheresoftware.b4j.objects.Pi4JWrapper$DigitalInputWrapper.Intiailize2(Pi4JWrapper.java:47)
at anywheresoftware.b4j.objects.Pi4JWrapper$DigitalInputWrapper.Initialize(Pi4JWrapper.java:44)
at b4j.example.main._start(main.java:83)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:629)
at anywheresoftware.b4a.shell.Shell.raise
EventImpl(Shell.java:234)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:111)
at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:100)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:98)
at b4j.example.main.main(main.java:29)
Caused by: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/jav
a.lang.reflect.Method.invoke(Method.java:566)
at com.pi4j.provider.impl.ProviderProxyHandler.invoke(ProviderProxyHandler.java:100)
... 23 more
Caused by: java.lang.UnsatisfiedLinkError: Pi4J was unable to extract and load the native library [/lib/armhf/libpi4j-pigpio.so] from the embedded resources inside this JAR [/tmp/tempjars/AsyncInput1]. to a temporary location on this system. You can alternatively define the 'pi4j.library.path' system property to override this behavior and specify the library path.
at com.pi4j.library.pigpio.util.NativeLibraryLoader.load(NativeLibraryLoader.java:170)
at com.pi4j.library.pigpio.internal.PIGPIO.<clinit>(PIGPIO.java:74)
at com.pi4j.library.pigpio.impl.PiGpioNativeImpl.gpioInitialise(PiGpioNativeImpl.java:91)
at com.pi4j.library.pigpio.PiGpio.initialize(PiGpio.java:146)
at com.pi4j.plugin.pigpio.provider.gpio.digital.PiGpioDigitalInputProviderImpl.create(PiGpioDigitalInputProviderImpl.java:60)
at com.pi4j.plugin.pigpio.provider.gpio.digital.PiGpioDigitalInputProvid
erImpl.create(PiGpioDigitalInputProviderImpl.java:41)
... 28 more
I updated with sudo apt intstall default.jdk
What could be wrong?