B4J Question WebViews on Pi

Discussion in 'B4J Questions' started by Jon Eskdale, Jan 14, 2019.

  1. Jon Eskdale

    Jon Eskdale Member Licensed 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

    Code:
    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
     

    Attached Files:

  2. Daestrum

    Daestrum Well-Known Member Licensed User

    from the Bellsoft website
     
    Erel likes this.
  3. Jon Eskdale

    Jon Eskdale Member Licensed 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
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    I don't think that there is any Java implementation available for RPi that supports WebView.

    It depends on what you are trying to do...
     
  5. Jon Eskdale

    Jon Eskdale Member Licensed 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
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    If the web page is not too complicated then you can download it with jOkHttpUtils2 and show it with a native UI.
     
  7. xulihang

    xulihang Active Member Licensed 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.
     
  8. Jon Eskdale

    Jon Eskdale Member Licensed 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
     
  9. Erel

    Erel Administrator Staff Member Licensed User

    Not sure what you mean with WebView here. WebView in the context of B4J is a JavaFX embedded browser engine. It is not available in the RPi Java runtime.
     
  10. Jon Eskdale

    Jon Eskdale Member Licensed User

    Thanks Erel - what I mean is a kiosk type browser something like this https://www.raspberrypi.org/forums/viewtopic.php?t=146729 in kiosk mode although I've not tried this one yet. I would need to have something like that running and have the ability to switch between it and the B4J screen. The Webview would have been ideal if it had worked.
     
  11. Michael1968

    Michael1968 Active Member Licensed User

    I think one solution could be Android things
    You can write the programm with b4a
     
    Erel likes this.
  12. Michael1968

    Michael1968 Active Member Licensed 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
     

    Attached Files:

  13. Jon Eskdale

    Jon Eskdale Member Licensed 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
     
  14. Michael1968

    Michael1968 Active Member Licensed User

  15. Jon Eskdale

    Jon Eskdale Member Licensed 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
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice