B4J Question Problem with jPi4J2 library - can't build standalone package

DitoNet

Member
Licensed User
Hello,
I'm creating app for RPi using jPi4J2 library, as described in this post: https://www.b4x.com/android/forum/threads/pi4j2-raspberry-pi-i-o-library.136113/#post-862693
Library and it's dependencies are in 'Additional Libraries' folder.
When I'm compiling app and running it on RPi using B4J Bridge, everything is fine.
But when I tried to build standalone package, I've received followed errors:
B4X:
B4JPackager11 Version 1.40
Exe name: PiTester.exe
build folder: D:\Grzegorz\Documents\B4X_PR~1\PiTester\Objects\temp\build
InputJar: D:\Grzegorz\Documents\B4X_Projects\PiTester\Objects\PiTester.jar
Running: D:\Grzegorz\Documents\B4X_PR~1\PiTester\Objects\temp\FindDosPath.exe
Running: D:\OpenJDK\bin\jar
Non-UI program
Package name: b4j.example
Running: D:\OpenJDK\bin\jdeps
Exception in thread "main" java.lang.module.FindException: Module com.pi4j not found, required by com.pi4j.plugin.raspberrypi
    at java.base/java.lang.module.Resolver.findFail(Resolver.java:877)
    at java.base/java.lang.module.Resolver.resolve(Resolver.java:191)
    at java.base/java.lang.module.Resolver.resolve(Resolver.java:140)
    at java.base/java.lang.module.Configuration.resolve(Configuration.java:411)
    at java.base/java.lang.module.Configuration.resolve(Configuration.java:245)
    at jdk.jdeps/com.sun.tools.jdeps.JdepsConfiguration.<init>(JdepsConfiguration.java:117)
    at jdk.jdeps/com.sun.tools.jdeps.JdepsConfiguration$Builder.build(JdepsConfiguration.java:563)
    at jdk.jdeps/com.sun.tools.jdeps.JdepsTask.buildConfig(JdepsTask.java:589)
    at jdk.jdeps/com.sun.tools.jdeps.JdepsTask.run(JdepsTask.java:543)
    at jdk.jdeps/com.sun.tools.jdeps.JdepsTask.run(JdepsTask.java:519)
    at jdk.jdeps/com.sun.tools.jdeps.Main.main(Main.java:49)
I'm new to B4J, what am I doing wrong?
How to add 'com.pi4j' module?

Regards, Grzegorz.
 

DitoNet

Member
Licensed User
The standalone package, built on Windows will not work with a Linux computer.
You need to build the package on the RPi. In this case you will likely to encounter other problems with the packager. It is really less suitable for RPi applications. Better to distribute the small Jar instead.
Erel, thanks for Your answer.
I know that standalone package builder generates EXE file for Windows, but I thought, that this step is also necessary to build standalone JAR for Linux.
Finally, I just compiled my project, transfered JAR file to my RPi, and run it without problems.

Regards, Grzegorz.
 
Upvote 0
Top