B4J Question How to get jar to run on Mac

rfresh

Well-Known Member
Licensed User
Longtime User
I'm still not clear on how to get my windows jar file to run on a Mac.

Erel's post (which is closed now) list the following steps:

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.
I understand this line.

Connect with B4J-Bridge to the mac. You need to run B4J-Bridge with Java 11+ downloaded from: https://www.b4x.com/android/forum/t...lest-way-to-distribute-ui-apps.99835/#content
I understand this line.

B4X: jdk-14.0.1/Contents/Home/bin/java -jar b4j-bridge.jar
Open B4J-Packager11 in the IDE and set the InputJar parameter.
The Packager is now built-in to the IDE so where do I now set the InputJar parameter?
#PackagerProperty: InputJar = jdk-14.0.1/Contents/Home/bin/java -jar b4j-bridge.jar
Is this setting slightly different on each of our machines or is the setting the same for everyone?


B4X: 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.
I'm not clear on how I "run it"?
 
Last edited:

rfresh

Well-Known Member
Licensed User
Longtime User
I downloaded mac-jdk-11 and installed it on my Mac. Terminal window: java -versions shows Java version 11.0.9 SE Runtime Enviroment

From finder I double click on the b4j-bridge.jar file and some folders were created, but I see nothing else. Is it running now somewhere on the Mac?
 
Upvote 0

rfresh

Well-Known Member
Licensed User
Longtime User
UPDATE:

I ran b4j-bridge.jar from the Mac terminal window.
I loaded B4JPackager11 on my windows machine.
I edited InputJar

B4X:
Private InputJar As String = "C:\Users\rfresh1011\Documents\3DGarmin430\fp2fms\Objects\fp2fms.jar" 'change as needed

I connected the B4J Bridge in the IDE to the Mac IP address.

I selected Release and pressed F5.

B4X:
B4J Version: 8.50
Java Version: 11
Parsing code.    (0.01s)
Building folders structure.    (0.01s)
Compiling code.    (0.03s)
Compiling layouts code.    (0.00s)
Organizing libraries.    (0.00s)
Compiling generated Java code.    (0.00s)
Building jar file.    (0.20s)
    Jar file created: C:\Users\rfresh1011\Downloads\B4JPackager11\Objects\B4JPackager11.jar
Running application.    (0.00s)
    Sending jar to B4J-Bridge
Completed successfully.

So it look likes B4JPackager11 still created a B4JPackager11.jar file, sent it over the bridge and completed successfully? I could not find B4JPackager11.jar on my mac.
 
Last edited:
Upvote 0

rfresh

Well-Known Member
Licensed User
Longtime User
Which log? There are several.
 

Attachments

  • 2021-01-01_070820.jpg
    2021-01-01_070820.jpg
    242.4 KB · Views: 135
Upvote 0

rfresh

Well-Known Member
Licensed User
Longtime User
I updated to B4j 8.80 and now with the B4JPackager11 loaded and I press F5, I get this same dialog but now nothing displays in the Mac log window. Se attachment.

I don't really understand what B4JPackager11 does, I don't have a mental picture of where and how it fits into creating my fp2fms.exe on the Mac. I copied my fp2fms.jar file over to the Mac. I don't understand how this whole process works. In other words, I am running B4jPackager11 but I don't know if that is the correct thing to be doing. I just don't understand the whole PC/Mac process.

Your first instruction line is: Run the project locally (on Windows) to generate the compiled jar. It will be in the Objects folder. Copy it to the Mac.
But you don't say where on the Mac? I copied my jar to the Mac but I'm sure it's not in the right place. I made a folder called fp2fms and I copied it there.

Open B4J-Packager11 in the IDE and set the InputJar parameter.

So in B4jPackager11 I changed this line:

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

to my own line:

Private InputJar As String = "C:\Users\rfresh1011\Documents\3DGarmin430\fp2fms\Objects\fp2fms.jar

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

So I set Release and press F5. Where on the Mac will these folders and files be created?
 

Attachments

  • 2021-01-01_103120.jpg
    2021-01-01_103120.jpg
    316.1 KB · Views: 124
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
The steps as seen from a flying airplane:
1. Build the jar on the Windows computer and copy it to the Mac.
2. Connect to the Mac with B4J-Bridge. This means that any app that you now run from the IDE will actually run on the Mac.
3. Run B4J-Packager11 to build the package.

But you don't say where on the Mac?
Doesn't matter.
Private InputJar As String = "C:\Users\rfresh1011\Documents\3DGarmin430\fp2fms\Objects\fp2fms.jar
Will not work. You need to set the local Mac path: "/users/username/Downloads/AngryBirds.jar"

You should see more information in the logs tab. Does it remain empty?
 
Upvote 0

rfresh

Well-Known Member
Licensed User
Longtime User
I see a lot of different log files. I'm not sure which one is the correct log to show you.

I cleared the different log files, one at a time, and pressed F5 and nothing displayed in the log file at that moment.

Where do I get the AngryBirds.jar file? I unzipped MacAngryBirdsExample.zip but that's the Mac version and doesn't show an AngryBirds.jar file.

My Mac downloads folder is located here:

/Macintosh HD/Users/christyfreshour/Downloads/AngryBirds.jar

I tried using: /Macintosh HD/Users/christyfreshour/Downloads/AngryBirds.jar

and

/Users/christyfreshour/Downloads/AngryBirds.jar

but no change in results.

I'm very confused about this whole process. I'm working with B4JPackager11 in B4J, I have AngryBirds.jar as my InputJar. What jar am I going to end up with on the Mac? Certainly not my desired B4J app fp2fms.jar. I just don't know what I am doing wrong and much of it is because I don't understand the process flow. I'm trying to put something over on the mac side and is it just one jar file or all of the distribution folders and that run.command file?

Q. When I copy my own fp2fms.jar file over to the Mac, don't I then have to use this line in B4JPackager11?
Private InputJar As String = "/Users/christyfreshour/Downloads/fp2fms.jar" 'change as needed

Q. When I use B4JPackager11 I use this compiler, correct?
C:\Program Files\Java\jdk1.8.0_161\bin\javac.exe

So the B4JPackager11 compile results show:

B4J Version: 8.80
Parsing code. (0.02s)
Java Version: 8
Building folders structure. (0.01s)
Compiling code. (0.02s)
Compiling layouts code. (0.00s)
Organizing libraries. (0.00s)
Compiling generated Java code. (1.08s)
Building jar file. (0.21s)
Jar file created: C:\Users\rfresh1011\Downloads\B4JPackager11\Objects\B4JPackager11.jar
Running application. (0.00s)
Sending jar to B4J-Bridge
Completed successfully.

I see the B4JPackager11.jar file on my windows PC in that downloads folder, but what jar file is being sent over to the Mac? The B4JPackager11.jar file? My own fp2fms.jar file is already on the Mac.

Q. And what gets built on the Mac? All those folders? bin,conf,legal,lib?

If I can ever get this figured out, I will write instructions targeted for the newbies like me. I know you (Erel) wrote instructions but they are at a high level aimed at well experienced users (unlike me). I had/have a lot of questions about most of the steps. I know you're extremely busy running your business and could not take the time to write a detailed step by step for newbies. So, as I said, I will do that as soon as I have some success with this Mac process myself and try to help out other newbies.
 

Attachments

  • 2021-01-03_070544.jpg
    2021-01-03_070544.jpg
    210.2 KB · Views: 122
Last edited:
Upvote 0

rfresh

Well-Known Member
Licensed User
Longtime User
The logs tab in the IDE is blank when I pressed F5. See attachment.

Q. What files and folders end up on the Mac after I press F5?

Q. When I copy my own fp2fms.jar file over to the Mac, don't I have to then use this line in B4JPackager11?
Private InputJar As String = "/Users/christyfreshour/Downloads/fp2fms.jar"

Q. When I use B4JPackager11, I use this compiler, correct?
C:\Program Files\Java\jdk1.8.0_161\bin\javac.exe

As you can see in the first attachment, the IDE shows a connection to the Mac. The second attachment shows the terminal window text when I run the bridge jar file.
 

Attachments

  • 2021-01-04_062654.jpg
    2021-01-04_062654.jpg
    364.5 KB · Views: 115
  • bridge.txt
    1.7 KB · Views: 124
Last edited:
Upvote 0

rfresh

Well-Known Member
Licensed User
Longtime User
I finally got the build to happen on the Mac side. Thank you Erel.
 
Last edited:
Upvote 0

rfresh

Well-Known Member
Licensed User
Longtime User
UPDATE: I made a small update to my B4J app and went to do another Mac build. My last one I had built successfully but this time, for some reason, I am getting a path error.

Please see the two attachments. I'm not exactly sure what the problem is.

Thank you...
 

Attachments

  • b4jpackager11.jpg
    b4jpackager11.jpg
    417.2 KB · Views: 115
  • mac path.jpg
    mac path.jpg
    143.7 KB · Views: 115
Upvote 0
Top