B4J Question Raspberry Pi B4J-Bridge Async1 or Async2

lip

Active Member
Licensed User
Longtime User
I compile from B4J bridge on Laptop to Raspberry Pi's. The code runs on the Pi, and the AppName.jar file arrives in the Objects folder on the Laptop. When it's tested and ready to deploy I transfer the AppName.jar file to the Pi and run it on startup using crontab. All good.

I the past, in addition to adding AppName.jar to the Objects folder in my Laptop, it also put the same jar file (named AsyncInput1 or AsyncInput2 without an extension) into a folder on the pi called /tempjars. This has stopped happening. I've searched every folder of the Pi for other 'tempjars' folders or any files called Async* but no sign.

Any idea why it has stopped, and if the .jar is somewhere else on the pi now?
 
Solution
Fixed! I call B4J-Bridge.jar on startup from Sudo Crontab with a full path: /home/pi/b4jbridge/b4j-bridge.jar. This meas that it runs from the root of the Pi, not the /home/pi folder nor the b4j-bridge folder.

The relevant [tempjars] folder is therefore in the hidden /root folder of the pi. The Pi's 'find' command does not look in hidden folders so I could not see it.

If anyone is interested, finding this has enabled me to automatically copy it to AppName.jar in the App's folder every time I compile it using B4J-Bridge. I no longer have to remember to connect to the Pi and transfer the .jar file from the Laptop's Objects folder every time I want to update the startup version of the App.

Copy AsynInput1 or 2 to AppName.jar on Startup.:
Sub AppStart

'Assumes B4J-Bridge called with...

lip

Active Member
Licensed User
Longtime User
Fixed! I call B4J-Bridge.jar on startup from Sudo Crontab with a full path: /home/pi/b4jbridge/b4j-bridge.jar. This meas that it runs from the root of the Pi, not the /home/pi folder nor the b4j-bridge folder.

The relevant [tempjars] folder is therefore in the hidden /root folder of the pi. The Pi's 'find' command does not look in hidden folders so I could not see it.

If anyone is interested, finding this has enabled me to automatically copy it to AppName.jar in the App's folder every time I compile it using B4J-Bridge. I no longer have to remember to connect to the Pi and transfer the .jar file from the Laptop's Objects folder every time I want to update the startup version of the App.

Copy AsynInput1 or 2 to AppName.jar on Startup.:
Sub AppStart

'Assumes B4J-Bridge called with full path from sudo Crontab, so the relevant tempjars folder is in hidden /root folder
If GetSystemProperty("b4j.ide", "false") Then
    If File.Exists("/root/tempjars","AsyncInput1") Then
        Log(Subs.TimedLog("B4J Bridge Running.  Copying AsyncInput1 to AppName.jar..."))
        Dim shl_CopyProgram As Shell
        shl_CopyProgram.Initialize("shl_CopyProgram","sudo",Array As String("cp","/root/tempjars/AsyncInput1","/home/pi/AppFolder/AppName.jar"))
        shl_CopyProgram.Run(-1)
      
    Else If File.Exists("/root/tempjars","AsyncInput2") Then
        Log(Subs.TimedLog("B4J Bridge Running.  Copying AsyncInput2 to AppName.jar..."))
        Dim shl_CopyProgram As Shell
        shl_CopyProgram.Initialize("shl_CopyProgram","sudo",Array As String("cp","/root/tempjars/AsyncInput2","/home/pi/AppFolder/AppName.jar"))
        shl_CopyProgram.Run(-1)
    Else
        Log(Subs.TimedLog("B4J Bridge Running but missing file '/home/pi/tempjars/AsyncInput1 or 2"))
    End If
Else
    Log(Subs.TimedLog("B4J Bridge Not Running."))
End If
 
Last edited:
Upvote 0
Solution
Top