B4J Question B4J Packager question/issue??


Active Member
I have never used the packager before and decided to learn/use it. There was a lot of trial and error, and scrapping of a number of forum threads to figure this packager out. And I am still not sure I am doing things properly. I am Linux only, no Android or Mac or Windows. So: (everything was done in release mode)

1: I used a sample program (not mine) to test it, using the internal packager everything worked fine, and was very easy to use. Produced a nice executable.
2: Unfortunately I am not a windows user, and need to do this via a separate Linux box, hooked up with the debugger.
3: I honestly could not figure out how to tell the internal packager to make a package remotely on the Linux platform, kept producing a Windows executable.
4: Switched to the B4J 1.21 external packager - changed the input string to point to the file on the remote Linux box, ran fine, everything worked.
5: The issue on the Linux box was - the external packager produces a bash file called run.command, I thought bash files had an extension of .sh, was a bit confusing at first.
For whatever reason (I am not a expert Linux user), I could not run the run.command bash script using sudo, or ./ from the terminal, however I was able to run it from the desktop by just double clicking it for the file explorer. Not sure why this is the case.

Now I tried my original program, that I am writing for my embedded boards.

1: Using the external packager, as with the before program, I was able to create the packaged files etc.., but whenever I ran the program, it immediately crashed (window would launch then immediately shut down). I just in case went back to windows and created an executable instead and the program worked fine.
2: Also tested in a compile and run mode (no debugger) on the Linux desktop, from the B4J environment - ran fine, so I copied the released Java file to the Linux desktop and ran it directly with no problems, using the Java - jar etc.. from the terminal.
3: My program at startup does a start of the serial ports, I stripped this call out, and reran the external packager and the program ran fine, so I have some kind of issue with the serial port initialization at run time????

To sum up the above into a few succinct questions:

1: Can the internal packager package for a Linux platform, what have I missed or done wrong (I don't know how to point to the external platform using the debugger - something probably obvious that I missed)- I am using B4j 8.5.

2: When using the external packager, something must be going wrong when jserial is in the code? Am I missing something in the steps, some declaration?

3: Is there a real difference in running (I can create a script) from the terminal using Java -jar, versus using the packager?? Is it worth the bother? The app is distributed on my embedded boards, only.

But I would still like to figure this out.


Active Member
1: It was not clear to me that the internal packager only works for a windows install. Thank you.
2: Yes it is a UI app.
3: I will look into running it from the command line, not sure why, but will it give me some kind of clue as why when using the external packager and enabling the serial ports in the code, the program crashes, versus running the same program from the Linux terminal without the installer, it runs fine?
4: Lastly, is it really necessary to use the packager in the first place?
Upvote 0


Active Member
Thanks for that, there will never be a user install of the software, the software is mounted on our systems in house before being sold. I am still interested in the serial port issue, I will try at a later point running the external installer from the command line and see if that produces any errors or as I saw, there is a debug batch file, which I assume would give me a better sense of what might be happening, just pure interest at this point.
Upvote 0