B4x rant thread

don’t think it is difficult to learn a new thing… i am just worry about how difficult to install to clients.

@Erel

What else do i need to install on the mac/window machine to use the jar file when deploy???
do i need to include all the other folders generated when i build??

1 Like

What else do i need to install<

Maybe this needs to go to the B4X forums themselves…? :slight_smile:

2 Likes

It may indeed be a better place. People who have done it may jump in and share their experience. (I don’t own a Mac so can’t really help here)

I deem this thread a success. Shorter than I might have initially expected, but upon reflection this group is mostly filled the Xojo diaspora. Seeing that getting started would immediately pose some hurdles is good to know. I wouldn’t have spent 3 days trying, my limit is usually 3 hours. This is good though. I now know that if i embark on that journey i’ll need to set aside a lot more time.

Thanks everyone!

Joe

setting up the things for development is the easy part… getting it deploy is the difficult part

2 Likes

I read the posts that Erel and others pointed to, but it’s not enough. I searched the B4X forum and couldn’t find any complete and working solution for building the “standalone” for macOS.

But I was able to pull together different pieces and got it working like this:

  1. Download OpenJDK as Erel cited above and unzip this to anywhere on your Mac. You will be running the java executable found in the bin folder from a terminal, so making it an easy path is recommended.
  2. Build the standalone app in B4J on Windows. This step is needed to create the jar and json files (couldn’t figure out a way to create these files without doing the full Windows standalone build).
  3. From the resulting Objects folder (parent of the temp/build folder that was just created), copy the <appname>.jar and packager.json files to a folder on the Mac (should use a separate folder because the build process to follow will overwrite the Windows build)
  4. Also copy the B4JPackager11.jar file from your Windows installation of B4J (Program Files (x86)\Anywhere Software\B4J).
  5. Modify the packager.json file to reflect the correct location of the jar file (just remove the entire path if you copied the jar file as directed in step 3).
  6. In a terminal window, change to this folder, then run:
    <../..>/bin/java -jar B4JPackager11.jar packager.json (replacing <…/…> with the path to the OpenJDK bin folder unzipped in step 1.
  7. This should result in a temp/build folder. This build folder contains everything to run the app on macOS. To run it you have to execute the run.command script from Terminal.

For rebuilding, only copy the jar file (after building the Windows package) and rerun step 6.

Still to do: Figure out how to “package” this build folder into a proper macOS app, and one that doesn’t leave a separate Terminal window behind (there’s talk on the forum of possible ways to accomplish this).

Note that you can add other things to the packager.json file. Some of the options I’ve seen look like this:

    {
    "IncludedModules": "javafx.web",
    "IconFile": "myicon.ico",
    "InputJar": "yourapp.jar"
    }
2 Likes

Thank J. Got it working now…

a simple hello world create 182MB file but when i include a ico file, it goes down to 134MB but when i double click on the run.command, it does not show the ico on the dock.

i manage to change the run.command to HelloWorld.command

a quick question, what libabry should i use to connect sqlite??

You have to use the search function in the B4X forum: https://www.b4x.com/android/forum/pages/results/?query=sqlite

And look for a post with the prefix Tutorial

FWIW:
I downloaded B4j today. I’m on Win10. Hello World exe generated is 93KB.

About the B4J Mac packages, I’ve just created one as an example.
https://www.b4x.com/b4j/files/MacAngryBirdsExample.zip (35mb)

You can run it by unzipping the package and clicking on run.command. As I previously wrote there is place for improvement here and this is not the case with Windows packages (which are simpler to create and include an executable).

Creating it is done with:

  • Run the project locally (on Windows) to generate the compiled jar. It will be in the Objects folder. Copy it to the Mac.
  • Connect with B4J-Bridge to the mac. You need to run B4J-Bridge with Java 11+ downloaded from the link I posted above:
jdk-14.0.1/Contents/Home/bin/java -jar b4j-bridge.jar 

Open B4J-Packager11 in the IDE and set the InputJar parameter. In most cases you don’t need the json file.

Private InputJar As String = "/users/username/Downloads/AngryBirds.jar"

Run it and the package will be created on the Mac. You need to distribute all the files under the build folder.

1 Like

@Erel, how come the exe is small???

The size of a standalone Windows package is also about 35mb (or 50mb if using WebView).

The exe file itself is small but it depends on the other files.

@Erel,
try doing the jave -jar on any jar file and i got the error on JavaFX component.
i check the javafx component in the folder and it is there.
i even try 14.0.2 which has javafx component

B4J-Bridge is a non-ui app so it can run with java -jar.

UI apps depend on additional components and should be distributed as explained above (it is also possible to distribute them in other cases, this should be discussed in B4X forum).

i know… i was doing just that… java -jar on terminal.
i read everything on the forum for the error message and try everything without success.

sorry… got it working now here is what shown in the terminal. i assume i need to put 25.45.79.3 for the bridge on the IDE

B4J-Bridge v1.40
Running on Java 11+

JavaFX modules: javafx.fxml,javafx.swt,javafx.media,javafx.graphics,javafx.swing,javafx.web,javafx.controls,javafx.base

External JavaFX path: /Library/Java/JavaVirtualMachines/jdk-14.0.2.jdk/Contents/Home/javafx/lib

Waiting for connections (port=6790)…

My IP address is: 25.45.79.3

FTP Server started: ftp://25.45.79.3:6781

Start B4J-Bridge with -disableftp to disable.

Welcome Jurgen !

1 Like

Thanks

1 Like