B4J Question WebViews on Pi

Jon Eskdale

Member
Licensed User
Longtime User
Please - is it possible to use a WebView on a Pi with B4J
I've my proof of concept working for a UI interfaced to the Serial port now
Next stage was the WebView which I thought would be the easy bit. I can get the Proof of Concept working in B4J on the PC but it doesn't work on the Pi

When you start the program on the Pi

B4X:
Program started.
java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)

The full error can be seen here if it helps
https://pastebin.com/BKX8ds3g
It's not a very helpful message to me at least.

This happens when the loadlayout is executed
I have a working program that runs on B4J on the PC but this is the simplest sample I could produce which has the error see tryVW.zip attached

B4J is version 7.00 and the Java on the Pi is BellSoft Liberica is a build of OpenJDK 11.0.1

Thanks - Jon
 

Attachments

  • tryWV.zip
    1.6 KB · Views: 200

Daestrum

Expert
Licensed User
Longtime User
from the Bellsoft website
JavaFX for the Raspberry Pi

Liberica JDK 11 come with a bundled JavaFX implementation which is based on OpenJFX. The following tables lists Java FX modules status of Liberica distribution

■ Java FX Graphics - works.

■ Java FX Controls - works.

■ Java FX Media - does not work.

■ Java FX Webkit - does not work.
 
Upvote 0

Jon Eskdale

Member
Licensed User
Longtime User
Thanks Daestrum - So
Is there a different Java implementation that I should use?
Some other solution?

Or do I have to forget about using B4J on the Pi and find some other language to use?

Thanks Jon
 
Upvote 0

Jon Eskdale

Member
Licensed User
Longtime User
Thanks Erel - The Project - A Fiend of mine has a small company designing and manufacturing Industrial Terminals. www.industrialdataproducts.co.uk I have written some software for him in the past. He now has a new terminal which is based on a Raspberry Pi and the touch screen together with a custom IO board housed in an industrial housing suitable for use on the Factory floor (This new terminal is not shown on the website yet). But a really nice industrial product. Typically this terminal is wired to a production machine and counts the units made and the production rate etc. The custom IO board communicates with the pi using the serial port. The Pi is networked via ethernet and is responsible for transferring the data from the Custom IO board to the Main server and vice versa for remote control It also displays status from the server as a web page (Kiosk mode) - hence the need for a webview. If there is a problem on the production machine the terminal is used by an operator via the touch screen to send the status (e.g. Stopped waiting for raw material, Stopped due to machine failure, Stopped due to material jam ....) As I've used B4A and B4i in the past and saw B4J was now available for the Pi, I suggested that we should write something in B4J so as to create a solution which would allow quick customisation of the product.
I have written him an Engineering screen as an example which communicates with the custom IO board and displays the information in B4J and this was well received. I then tried to write a demo webview not realising this would be an issue. He also has some Terminals with larger screens 15 inch but otherwise similar in production.

I've done some work with Pi's in the past but not a lot, Primarily I'm a Windows / Microcontroller programmer with hardware design experience.
Do I try and mix languages/solutions or any ideas Would like to keep the B4J
Thanks Jon
 
Upvote 0

xulihang

Active Member
Licensed User
Longtime User
I think one solution is to make a server app and open the website on local browser and use websocket or ajax to update the webpage.
 
Upvote 0

Jon Eskdale

Member
Licensed User
Longtime User
Thanks Erel - but don't think that would work as the web page is dynamically updated as the production changes and I wouldn't know when to download it.
I wonder if the Liberica JDK 11 will ever support the webkit on Pi or if they have no intention of looking at it.
Would it be possible to have a WebView running as a separate app and have B4J control whether the Webview is displayed or if B4J screen is displayed?
The plan was to have a 3-second press on the Webview to switch to the B4J main screen and then a button on the main B4J screen to switch back to the Webview.
I had that working in B4J on the PC but it won't work on the Pi. Is that something B4J could do?
Thanks Jon
 
Upvote 0

Michael1968

Active Member
Licensed User
Longtime User
Hi Jon

I have make a quick test with my raspberrypi 3B with the official 7" Display.

-> latest image (1.0.8) on 4 Gb SD-Card
-> webview work
-> all testet xui example work
 

Attachments

  • WIN_20190114_22_46_13_Pro.jpg
    WIN_20190114_22_46_13_Pro.jpg
    99 KB · Views: 260
Upvote 0

Jon Eskdale

Member
Licensed User
Longtime User
Hi Michael - That sounds extremely interesting.
Could you confirm what you mean by latest image 1.0.8
I have the latest Raspbian-stretch-full installed
and B4J 7.00
I've installed the Java bellsoft-jdk11.0.1-linux-arm32-vfp-hflt-lite.tar.gz
Could you confirm what java you are using

Many Thanks - Jon
 
Upvote 0

Jon Eskdale

Member
Licensed User
Longtime User
Hi Michael, Thanks - I did some reading on the Android Things and it appears Google classify the Pi as Development only - not approved for production. Which would cause problems selling the Android things concept to some customers I think. It also says that it only supports the MicroSD card. We are running the pi from an SSD connected via a USB adapter as we had too many failures of SD card in use. Its a few pounds extra but the reliability pays for itself. Still looking for/working on a solution - Thanks
 
Upvote 0
Top