B4J Question [SOLVED] [BANano] Deploying BANano WebApp On Linux: Could not locate b4xV5.ini! Is B4J installed?

Mashiane

Expert
Licensed User
Longtime User
Good day

I need help deploying a BANanoServer app on Linux i.e. BANano REST API Server with PWA project

1. The app generated and saved in the Objects folder has been "deployed" to the linux machine. This is made up of the jar file, the server.ini file and the www folder.

B4X:
[root@localhost /]# cd whatsapp
[root@localhost whatsapp]# dir
appVars.map  BANanoServerPablo.jar  nohup.out  server.ini  www
[root@localhost whatsapp]# java -jar BANanoServerPablo.jar
Reading B4J INI in /whatsapp to find Additional Libraries folder...
Could not locate b4xV5.ini! Is B4J installed?
[root@localhost whatsapp]# which java
/usr/bin/java
[root@localhost whatsapp]# java -version
openjdk version "17.0.14" 2025-01-21 LTS
OpenJDK Runtime Environment (Red_Hat-17.0.14.0.7-1) (build 17.0.14+7-LTS)
OpenJDK 64-Bit Server VM (Red_Hat-17.0.14.0.7-1) (build 17.0.14+7-LTS, mixed mode, sharing)
[root@localhost whatsapp]#

Can you please advise?

Thanks in advance.

PS: This is the first time Im doing anything Linux related.
 
Last edited:
Solution
Situation:

It is a situation for BANano projects only. The problem is when the app runs it it trying to re-transpile the WebApp, which it does not need to do. If you do not use a BANanoServer, you do not need the .jar file, generating it once is enough.

Solution:

We can catch this by adding a startup parameter. If there is a startup parameter (let's say -run, but can be anything really), we want to skip re-transpiling. It is not needed as long was we run it in release mode on our development machine, the app is generated in the www folder.

As no code is provided, this is the best I can do:
B4X:
' in Sub AppStart (Args() As String)
...
If Args.Length = 0 Then
        ' initialize BANano...

DonManfred

Expert
Licensed User
Longtime User
Reading B4J INI in /whatsapp to find Additional Libraries folder...
Looks like a log-entry from the B4J-IDE.

I don´t think a generated B4J-App Jar is searching for the b4xV5.ini

Except if your code (your jar file) is searching for the ini file......
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
BTW: "libs" folder with dependencies libs .jar files used ? Seems, no.
 
Last edited:
Upvote 0

alwaysbusy

Expert
Licensed User
Longtime User
Situation:

It is a situation for BANano projects only. The problem is when the app runs it it trying to re-transpile the WebApp, which it does not need to do. If you do not use a BANanoServer, you do not need the .jar file, generating it once is enough.

Solution:

We can catch this by adding a startup parameter. If there is a startup parameter (let's say -run, but can be anything really), we want to skip re-transpiling. It is not needed as long was we run it in release mode on our development machine, the app is generated in the www folder.

As no code is provided, this is the best I can do:
B4X:
' in Sub AppStart (Args() As String)
...
If Args.Length = 0 Then
        ' initialize BANano
        Server.BANano.Initialize("BANano", PWAName, 1)
End If
...
If Args.Length = 0 Then
        ' BUILD PWA
        Server.BANano.BuildForRESTAPWithPWA(File.Combine(File.DirApp,"www"))
End If

This way, usage is pretty simple:

On your DEV PC (which has B4J installed):
1. run in release mode to generate the PWA and the .jar

On the deploy server (without B4J installed):
1. Copy the www folder, server.ini, the .jar and whatever other files you need
2. start the server with java -jar yourapp.jar -run

The code "If Args.Length = 0 Then" will return false and hence not try to initialize BANano or run the Build command.

Alwaysbusy
 
Upvote 1
Solution
Top