B4J Question [Solved] Creating a Linux package with B4JPackager11

aeric

Expert
Licensed User
Longtime User
Platforms

You must build the package on the target platform.
Windows - Java 11 should already be installed. Note that Java 11 is 64 bit only.

OpenJDK 11 + OpenJFX 11 (SDK + jmods) - GPL + classpath exception license
Mac - https://b4xfiles-4c17.kxcdn.com/b4j/mac_jdk-11.0.1.zip
Linux - https://b4xfiles-4c17.kxcdn.com/b4j/linux_jdk-11.0.1.zip
Referring to the tutorial https://www.b4x.com/android/forum/t...the-simplest-way-to-distribute-ui-apps.99835/

I am confused with the steps explained above.

Where should I extract linux_jdk-11.0.1.zip to?
Answer: I extracted to /home/{user}/jdk-11.0.1

How do I build the package on the target platform?
Answer:
1. Build Release app from B4J IDE in Windows.

2. Copy B4JApp.jar file from Objects folder to Linux /home.

3. Copy B4JPackager11.jar to Linux /home.

4. Create packager.json in Linux /home
B4X:
{
  InputJar: "/home/com/B4JApp.jar",
  IncludedModules: ["jdk.crypto.ec"]
}
*Note: com is my username in Linux

5. Run the following command in Linux:
B4X:
/home/com/jdk-11.0.1/bin/java -jar B4JPackager11.jar packager.json

6. The package is created in /home/com/temp/build

A video tutorial may be much helpful. Thanks.
 
Last edited:

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User
this 2 will give you an insight

compile in linux:

compile in mac:

TL:DR, download java as you may do usually in linux and connect the IDE with b4j bridge.
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
this 2 will give you an insight

compile in linux:

compile in mac:

TL:DR, download java as you may do usually in linux and connect the IDE with b4j bridge.
The java openjdk 11.0.8 is missing JavaFX.

I extracted the openjdk 11.0.1 and call java -jar but error show Java not found.

I am using the latest Ubuntu 20.04.1 LTS desktop.

I tried to merge both files, it seems to work. I think this is not a proper way.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0

aeric

Expert
Licensed User
Longtime User
I am not sure why when I click on the .sh or run.command in Ubuntu 20.04, it opens TextEditor and doesn't execute the script. When I run using terminal (sometimes with sudo), the script runs.
I found the solution.
Source: https://askubuntu.com/a/1255819

Click the hamburger menu and select Preferences. Go to Behavior tab, under Executable Text Files, select Run them.
1602641877245.png


1602641910468.png
 
Upvote 0

BPak

Active Member
Licensed User
Longtime User
Referring to the tutorial https://www.b4x.com/android/forum/t...the-simplest-way-to-distribute-ui-apps.99835/

I am confused with the steps explained above.

Where should I extract linux_jdk-11.0.1.zip to?
Answer: I extracted to /home/{user}/jdk-11.0.1

How do I build the package on the target platform?
Answer:
1. Build Release app from B4J IDE in Windows.

2. Copy B4JApp.jar file from Objects folder to Linux /home.

3. Copy B4JPackager11.jar to Linux /home.

4. Create packager.json in Linux /home
B4X:
{
  InputJar: "/home/com/B4JApp.jar",
  IncludedModules: ["jdk.crypto.ec"]
}
*Note: com is my username in Linux

5. Run the following command in Linux:
B4X:
/home/com/jdk-11.0.1/bin/java -jar B4JPackager11.jar packager.json

6. The package is created in /home/com/temp/build

A video tutorial may be much helpful. Thanks.
Thanks for clear instructions. Used your info to build my apps on LinuxMint 18.2 on my Laptop.
Can copy the build to a USB with a linux format and then copy to other Linux distributions. Works a treat!!!
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
Today I am facing issue with building a package under Linux which doesn't include JavaFX.
Finally I found out that I was using B4JPackager version 1.21.
Copy the latest B4JPackager.jar version 1.40 from B4J installation folder to Linux solved the issue.
 
Upvote 0
Top