"Webify" your B4J desktop app

chams

Member
Licensed User
Longtime User
I made a utility at work as desktop app. But for each update, I had to reinstall the new app on all desktops.
Running the app from the corporate network was long (10 sec to launch) (python app + tkinter compiled with cx_freeze)
The idea was to run the app from http server, without rewriting the interface. I discovered a gold nugget, and want to share it with you. The name is “cloudtk”.
( http://cloudtk.tcl-lang.org/
https://wiki.tcl-lang.org/page/CloudTk )
CloudTk works on Linux. It is a http server, that enable to launch a application in a noVNC web page. (NoVNC is a VNC viewer in HTML5).
Originally made to run Tk applications, you can run in your browser all applications running on a Linux system including B4J apps of course!
You can run your app in full screen, or as iframe from http or https.
Once you have configured your server, create a subdirectory in the Tk folder, put your “jar” inside, with a file called TkStartup.tcl
Write your command line in it :
set ix [lsearch $argv -display]
if {$ix >= 0} {
incr ix
set env(DISPLAY) [lindex $argv $ix]
set argc 0
set argv {}
exec java -jar CloudB4x.jar
}

A demo sample:
Capture d’écran de 2021-03-13 19-38-45.png

Online demos provided by the author Jeff Smith are here : https://wiki.tcl-lang.org/_fulltextsearch
If you wish “a cook book” for cloudtk installation, let me know !
 

aeric

Expert
Licensed User
Longtime User
This is similar to the post:
 

chams

Member
Licensed User
Longtime User
Thank you for this link ! I think that the underlying technologie is the same. (A webserver with RFB technolgy (VNC) that catch the frame buffer of the launched app, redirect using SSL to a websocket to an embedded VNC client build in HTML5. The difference seams to be that cloudtk can run any kind of linux software, webswing only the java one. On the other hand, webswing seams to manage local printers. I will make a test :)
 

virpalacios

Active Member
Licensed User
Longtime User
I made a utility at work as desktop app. But for each update, I had to reinstall the new app on all desktops.
Running the app from the corporate network was long (10 sec to launch) (python app + tkinter compiled with cx_freeze)
The idea was to run the app from http server, without rewriting the interface. I discovered a gold nugget, and want to share it with you. The name is “cloudtk”.
( http://cloudtk.tcl-lang.org/
https://wiki.tcl-lang.org/page/CloudTk )
CloudTk works on Linux. It is a http server, that enable to launch a application in a noVNC web page. (NoVNC is a VNC viewer in HTML5).
Originally made to run Tk applications, you can run in your browser all applications running on a Linux system including B4J apps of course!
You can run your app in full screen, or as iframe from http or https.
Once you have configured your server, create a subdirectory in the Tk folder, put your “jar” inside, with a file called TkStartup.tcl
Write your command line in it :
set ix [lsearch $argv -display]
if {$ix >= 0} {
incr ix
set env(DISPLAY) [lindex $argv $ix]
set argc 0
set argv {}
exec java -jar CloudB4x.jar
}

A demo sample:
View attachment 109589
Online demos provided by the author Jeff Smith are here : https://wiki.tcl-lang.org/_fulltextsearch
If you wish “a cook book” for cloudtk installation, let me know !

Hi Chams, these are good news about running BJ4 in a browser, I thinks in some programs we need to generate reports in PDF for user, I wonder how we can address this issue, maybe a download link. I will start some testing with My RPi 4, it has 4Gb and and SDD.

Please keep us informed about your results in tests.

Best Regards

Virgilio
 

chams

Member
Licensed User
Longtime User
Hi Chams, these are good news about running BJ4 in a browser, I thinks in some programs we need to generate reports in PDF for user, I wonder how we can address this issue, maybe a download link. I will start some testing with My RPi 4, it has 4Gb and and SDD.

Please keep us informed about your results in tests.

Best Regards

Virgilio
Hello Virgilio !
VNC protocol only displays the screen. May be the easiest way is to display the report in your app running in the matchbox window, or / and ask the user to put his email address and send them the pdf.
You can also generate the pdf in a directory of a standard webserver on the same machine and put the link to the clipboard. If i find something more "elegant", i'll tell you :)
 

virpalacios

Active Member
Licensed User
Longtime User
Hello Chams!!!, all options sound good for me, I was thinking about the link one, but I will try all them,

Best Regards and Thank you for your comments

Virgilio
 

virpalacios

Active Member
Licensed User
Longtime User
Hi Champs, I just got the app running , however I want to know if you can start the app directly without the selection page.

Best Regards
 

chams

Member
Licensed User
Longtime User
Sorry, i was not connected :rolleyes: ! But you found the solution 👌
A more "elegant" way to communicate between your app and the browser, is maybe to use google fcm push notifications. Not tested yet !
 

manuelcristobal

New Member
Hello, how are you? I want to ask you, if it is possible that you create or have a manual on how to install cloudtk and I want to ask if cloudtk works only on linux or can I use it on windows?
 

virpalacios

Active Member
Licensed User
Longtime User
Hello Manuel, I did some research about using windows, however i couldn't find a way. But I have a project using apache and maria db using a Docker instance on a windows machine (Linux containers running on windows). Maybe it could be a way to run b4j webapps on a windows environment.

Best Regards

Virgilio
 
Top