B4J Question PI4J V.2 Rasberry pi4 problem

roberto64

Active Member
Licensed User
Longtime User
Hi, after various tests on rasberry PI4 with B4J and PI4J V.2 in my case I find the discrepancies, I explain, with the version of Java 11.0.7 installed on debiian known that with the result of the program in "(UI javaFX) by a error "Error: --add-modules = requires modules to be specified", instead with java v.14.0.8 it works, but in the execution of the command "Dim bus As JavaObject = GetBus (1)" from error in java, when you use "non-ui console" everything works well, but only with the version of Java v.11.0.7 but it does not show the form. I ask if anyone of the forum had the same problems and if possible share them.
regards
 

roberto64

Active Member
Licensed User
Longtime User
Rasberri pi:
    Dim bus As JavaObject = GetBus(1)
    Dim device As JavaObject = GetDevice(bus, 0x27)
    
    
    
    
Sub GetBus(BusNumber As Int) As JavaObject
    Dim factory As JavaObject
    Return  factory.InitializeStatic("com.pi4j.io.i2c.I2CFactory").RunMethodJO("getInstance", Array As Object(BusNumber))
    End Sub

Waiting for debugger to connect...
Program started.
0
Esatto
Error occurred on line: 94
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/java.lang.reflect.Method.invoke(Method.java:564)
at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:132)
at anywheresoftware.b4j.object.JavaObject.RunMethodJO(JavaObject.java:139)
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:564)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:632)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(She
ll.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:564)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:91)
at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:98)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:78)
at b4j.example.main.main(main.java:30)
Caused by: java.lang.InternalError: java.nio.DirectByteBuffer.<init>(int,long,java.io.FileDescriptor,java.lang.Runnable)
at com.pi4j.io.file.LinuxFile.<clinit>(LinuxFile.java:89)
at com.pi4j.io.i2c.impl.I2CBusImpl.open(I2CBusImpl.java:124)
at com.pi4j.io.i2c.impl.I2CProviderImpl.getBus(I2CProviderImpl.java:56)
at com.pi4j.io.i2c.I2CFactory.getInstance(I2CFactory.java:79)
.
.. 21 more
 
Upvote 0
Top