B4J Question B'JPackager11 and Debian / Raspberry 3B

CR95

Active Member
Licensed User
i developed a B4J server application running on a Raspberry 3B with Debian. As it is a Non-UI appli, installation is made with B4J Bridge and it works fine.

I would like to develop a second UI appli and I understood that installation has to be made with B4JPackager11.
To verify the feasability, I copied in a directory under Debian :
- B4JPackager11.jar ---> coming from the directory c:/Program Files/Anywhere Software/B4J.......
- jdk-11.0.1 ---> containing the runtime unzipped from linux_jdk-11.0.1.zip
- TurtleFormula.jar build under Windows/B4J/Build Standalone Package
- packager.json ---> which has to be modified because the address generated in the file begins with C:/.... which is the address for Windows

Following the B4JPackager11 generation procedure, I send "jdk-11.0.1/bin/java -jar B4JPackager11.jar packager.json
I get this error message :
Debian.jpg


In French, the error message says it is impossible to execute the binary file because there is an error format for exec.

FYI, I made the same installation on a KUBUNTU system and everything goes well till the end.

I think that the issue is linked to the Raspberry target system and I made some research on the cloud. I found it could come from a 32 bits system trying to execute a program made for 64 bits.

Please could you confirm that this is the issue and, if yes, is there a work around existing ?

Thanks
 

hatzisn

Well-Known Member
Licensed User
Longtime User
This is an issue I also faced. Try to write 1st ./B4JPackager.jar and ./packager.json. Then make sure you have the correct bit version of Debian. I think it should be 32 if I am not wrong and that is intented for ARM.
 
Upvote 0

CR95

Active Member
Licensed User
Thanks Nikolaos

Yes, my system is 32 bits (command getconf LONG_BIT -> answer = 32) and architecture = ARM (see my photo)

I do not understand what you mean by :
Try to write 1st ./B4JPackager.jar and ./packager.json
Please could you explain ?
Does it solve the issue ?
 
Upvote 0

hatzisn

Well-Known Member
Licensed User
Longtime User
You will have to replace the .jar and .json just above the message "...impossible d exécuter le fichier..." with what I wrote. Also make sure in Raspberry Pi to use the Liberica Java 32 bit because as I see clearly now it is a problem in execution of java.

Why don't you use Raspberry Pi OS (Former Raspbian)?
 
Last edited:
Upvote 0

hatzisn

Well-Known Member
Licensed User
Longtime User
Upvote 0

CR95

Active Member
Licensed User
@Nikolaos,
I test with your suggested modified command :
B4X:
jdk-11.0.1/bin/java -jar ./B4JPackager11.jar ./packager.json
and I got the same error (see photo)

As requested :
- my Liberica is the version recommanded by EREL in "B4J Tutorial Raspberry Pi with Java 11". The file name is bellsoft-jdk11.0.1-linux-arm32-vfp-hflt-lite.tar.gz
- I am using the OS recommended by the PI Organization. The file name is "2021-05-07-raspios-buster-armhf-full"

I visited the thread Libera as you recommended. When I installed the system one year ago, I followed a similar procedure (the one recommended by EREL in his tutorial). I guess that I did not execute the 2 commands following the tar command (as explained in the LIberica thread)
• sudo update-alternatives --install /usr/bin/java java /usr/java/jdk-11.0.10-full/bin/java 1000 • sudo update-alternatives --install /usr/bin/javac javac /usr/java/jdk-11.0.10-full/bin/javac 1000:
• sudo update-alternatives --install /usr/bin/java java /usr/java/jdk-11.0.10-full/bin/java 1000
• sudo update-alternatives --install /usr/bin/javac javac /usr/java/jdk-11.0.10-full/bin/javac 1000

In the following photo, you will find some tests and the result of the 2 additional commands that were not executed when I installed the PI.
TestJava.jpg

In french, it is said that there is only one alternative for java and for javac

I continue to search and I found an interesting information in the thread B4J Tutorial Raspberry Pi B4J UI Applications with Liberica JDK of rwblinn
He says that we should have
B4X:
$javac -version
javac 10-BellSoft

$java -version
openjdk version "10-BellSoft" 2018-03-20
OpenJDK Runtime Environment (build 10-BellSoft+0)
OpenJDK Server VM (build 10-BellSoft+0, mixed mode)
His versions are noted "Bellsoft" and not "11.0.11" as mine. Do you think the problem could be here (bad installation) ?
 
Upvote 0

hatzisn

Well-Known Member
Licensed User
Longtime User
I cannot say for sure. Did you use the original media creator from raspberry foundation to burn to the SD card the Raspberry Pi OS ?
 
Upvote 0

CR95

Active Member
Licensed User
Thanks NIkolaos for spending time

After researchs, I found that the error message comes when we try to execute X86 exe on ARM processor.
That will explain why my package runs on my Kubuntu which is installed on X86 PC and not on my Raspberry.

Moreover, it seems that I did not understand the global procedure. For me, building/compilation was made on Windows and then the java generated by the compilation was copied and used with B4JPackager on the Raspberry. It is a big error. Compilation has also to be made on the Raspberry. Please could you confirm ?
 
Upvote 0

hatzisn

Well-Known Member
Licensed User
Longtime User
Thanks NIkolaos for spending time

After researchs, I found that the error message comes when we try to execute X86 exe on ARM processor.
That will explain why my package runs on my Kubuntu which is installed on X86 PC and not on my Raspberry.

Moreover, it seems that I did not understand the global procedure. For me, building/compilation was made on Windows and then the java generated by the compilation was copied and used with B4JPackager on the Raspberry. It is a big error. Compilation has also to be made on the Raspberry. Please could you confirm ?

No, compilation can occure on Windows and you can transfer the .jar file which is located in the Objects directory. In post #2 the ARM solution was proposed. To transfer files easier what I have done is that I have installed in Raspberry Pi "proftpd" ftp server and I FTP my files to RasPi. This is the command in RasPi to install it and you login with your credentials you log in RasPi:

sudo apt-get install proftpd
 
Upvote 0

CR95

Active Member
Licensed User
@DonManfred
I was not clear. I guess I don't create an exe. Sorry.
As I said in first thread, I follow EREL's procedure and I compile under Windows/B4J using the "Build Standalone Package". At the end, B4J opens a window showing a "build" repertory. I move two directories upper in a directory named "Objects" and from there, I copy 2 files "TurtleFormula.jar" and "packager.Json" to the Raspberry directory (using FileZilla). Then, I follow EREL's "packaging" procedure from the Raspberry.

@Nikolaos
So, my "theory" is false.

I found a new way to describe my issue :
- under Raspberry, if I type "java" in my directory "B4JPackager/jdk11.0.1/bin", I receive a lot of lines with the syntax of the java command and its options.
- then, I move 2 directories upper in "B4JPackager", and if I type " jdk11.0.1/bin/java", I receive the error message.
Why the same program is found or not ?
 
Upvote 0

hatzisn

Well-Known Member
Licensed User
Longtime User
To compile just press F5 or click the ("play") triangle and this will create the .jar file which you will transfer.
The Build Standalone is just to create a standalone as it says package which runs under windows. Search in forum for B4J packager.
 
Upvote 0

hatzisn

Well-Known Member
Licensed User
Longtime User
@Nikolaos
So, my "theory" is false.

I found a new way to describe my issue :
- under Raspberry, if I type "java" in my directory "B4JPackager/jdk11.0.1/bin", I receive a lot of lines with the syntax of the java command and its options.
- then, I move 2 directories upper in "B4JPackager", and if I type " jdk11.0.1/bin/java", I receive the error message.
Why the same program is found or not ?

Linux is very strict and case sensitive. What I do is that I reference always the current folder with the dot.
F.e. if I am in the parent folder of B4JPackager then I write "./B4JPackager/jdk11.0.1/bin/java". The error though indicates that it is an architecture problem. When I had created a Debian 10.4 virtual machine and I had installed the 64 bit ARM version I was facing the same problem but when I switched to 64 bit AMD everything worked fine (the VM was tested in windows). So the same can be your problem. If you have installed a wrong version of Debian.

Make sure you are using Raspberry Pi OS 32bit (former raspbian which targets 32bit ARM).
 
Upvote 0

CR95

Active Member
Licensed User
@Nikolaos
Thanks for spending your time for helping me
As this packaging operation is not critical for me, I will wait for a visit of my son who is expert in Linux/Java ; I am sure he will find the issue in front of the display (he always found the solutions).
I will keep you informed
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
For me, building/compilation was made on Windows and then the java generated by the compilation was copied and used with B4JPackager on the Raspberry. It is a big error. Compilation has also to be made on the Raspberry. Please could you confirm ?
Hm. That should have been the correct steps. Build project in release mode on PC. Build B4JPackager11 in release mode on PC. Copy project JAR file and B4JPackage11 JAR file to Raspi. Use B4JPackager11 JAR file on Raspi to build platform specific distribution of your project.
 
Upvote 0
Top