B4J Tutorial Raspberry Pi with Java 11

Discussion in 'B4J Tutorials' started by Erel, Nov 22, 2018.

Thread Status:
Not open for further replies.
  1. Erel

    Erel Administrator Staff Member Licensed User

    Running UI apps on Raspberry Pi with Java 11 is relatively simple.

    1. Download Liberica JDK: https://www.bell-sw.com/java-for-raspberry-pi-11-preview.html

    2. Copy it to the RPi and unpack it:
    Code:
    tar -xvf bellsoft-jdk11-linux-arm32-vfp-hflt-lite.tar
    3. Download the latest version of b4j-bridge (1.41+).
    Code:
    wget www.b4x.com/b4j/files/b4j-bridge.jar
    4. Run b4j-bridge:
    Code:
    sudo jdk-11/bin/java -jar b4j-bridge.jar
    The 'sudo' is important. Keyboard and mouse will not work without it.

    The output should look like this:
    Code:
    B4J-Bridge v1.41
    Running on Java 
    11+
    External JavaFX 
    not found. Searching for internal modules...
    Waiting 
    for connections (port=6790)...
    My IP 
    address is192.168.0.42
    FTP Server started: ftp://192.168.0.42:6781
    Start B4J-Bridge with -disableftp 
    to disable.
    JavaFX modules: javafx.base,javafx.controls,javafx.fxml,javafx.graphics,javafx.media,javafx.web
    5. Connect B4J to the bridge (Tools - B4J Bridge).

    Notes:

    - Requires B4J v6.80 (currently in beta).
    - Not all features are supported. Specifically WebView and media features are not supported.
     
  2. jcohedman

    jcohedman Member Licensed User

    it runs, but the numeric pad don't respond.
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    Search Google for rpi numeric pad not working. There are many related discussions.
     
    jcohedman likes this.
  4. peridot

    peridot New Member Licensed User

    Never posted before but trying to install B4J - Bridge and Java11 on Pi Zero so i can use B4J 6.8
    Have carried out the steps in first post but get error when i try to run Bridge

    pi@raspberrypi:~ $ sudo jdk-11/bin/java -jar b4j-bridge.jar
    Illegal instruction

    Can anyone help?
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    Liberica JDK supported platforms: "32-bit version suitable for current versions of Raspbian and supported on Raspberry Pi 2 and Raspberry Pi 3"
     
  6. techknight

    techknight Well-Known Member Licensed User

    Probably the whole ArmV6 and ArmV7 debacle. JDK11 is probably compiled against armv7.

    I currently have an older raspberry pi armv6 powering my front door (entry system) so I am going to leave it on java 8 indefinitely.
     
  7. derez

    derez Expert Licensed User

    I try java11 on raspberry in order to see if the problems I get in linux are mine...
    I installed the java 11 as explained above, bridge 1.42 and use 6.80 beta.
    The application I try is using sqlite and RDC.
    The server starts fine (until the line with JRDC is running) but when the client starts i get the following:
    Code:
    Waiting for debugger to connect...
    Program started.
    2018-12-05 14:18:17.784:INFO::main: Logging initialized @2743ms to org.eclipse.jetty.util.log.StdErrLog
    Dec 
    052018 2:18:18 PM com.mchange.v2.log.MLog
    INFO: MLog clients using java 
    1.4+ standard logging.
    Dec 
    052018 2:18:20 PM com.mchange.v2.c3p0.C3P0Registry
    INFO: Initializing c3p0-
    0.9.5.2 [built 08-December-2015 22:06:04 -0800; debug? true; trace: 10]
    2018-12-05 14:18:30.200:INFO:oejs.Server:main: jetty-9.4.z-SNAPSHOT; built: 2018-05-03T15:56:21.710Z; git: daa59876e6f384329b122929e70a80934569428c; jvm 11-BellSoft+0
    2018-12-05 14:18:30.620:INFO:oejs.session:main: DefaultSessionIdManager workerName=node0
    2018-12-05 14:18:30.622:INFO:oejs.session:main: No SessionScavenger set, using defaults
    2018-12-05 14:18:30.640:INFO:oejs.session:main: node0 Scavenging every 600000ms
    2018-12-05 14:18:30.698:INFO:oejsh.ContextHandler:main: Started o.e.j.s.ServletContextHandler@134fff9{/,file:///home/pi/tempjars/www,AVAILABLE}
    2018-12-05 14:18:30.719:INFO:oejs.AbstractNCSARequestLog:main: Opened /home/pi/tempjars/logs/b4j-2018_12_05.request.log
    2018-12-05 14:18:30.827:INFO:oejs.AbstractConnector:main: Started ServerConnector@4a552{HTTP/1.1,[http/1.1]}{0.0.0.0:57665}
    2018-12-05 14:18:30.832:INFO:oejs.Server:main: Started @15857ms
    Emulated network latency: 100ms
    jRDC is running (version = 2.1)
    Dec 05, 2018 2:19:30 PM com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource
    INFO: Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 20000, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, contextClassLoaderSource -> caller, dataSourceName -> z8kfsx9zz1me0w1lp24y7|cddd20, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> com.mysql.jdbc.Driver, extensions -> {}, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, forceSynchronousCheckins -> false, forceUseNamedDriverClass -> false, identityToken -> z8kfsx9zz1me0w1lp24y7|cddd20, idleConnectionTestPeriod -> 600, initialPoolSize -> 3, jdbcUrl -> jdbc:mysql://localhost/recipe?characterEncoding=utf8, maxAdministrativeTaskTime -> 0, maxCo
    nnectionAge -> 0, maxIdleTime -> 1800, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 15, maxStatements -> 150, maxStatementsPerConnection -> 0, minPoolSize -> 3, numHelperThreads -> 3, preferredTestQuery -> null, privilegeSpawnedThreads -> false, properties -> {password=******, user=******}, propertyCycle -> 0, statementCacheNumDeferredCloseThreads -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> true, unreturnedConnectionTimeout -> 0, userOverrides -> {}, usesTraditionalReflectiveProxies -> false ]
    Dec 05, 2018 2:20:02 PM com.mchange.v2.resourcepool.BasicResourcePool
    WARNING: com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@b183c8 -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception:
    com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
    The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
        at jdk.internal.reflect.GeneratedConstructorAccessor7.newInstance(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
        at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:989)
        at
    com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:341)
        at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2203)
        at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2236)
        at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2035)
        at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:790)
        at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
        at jdk.internal.reflect.GeneratedConstructorAccessor5.newInstance(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
        at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:400)
        at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:330)
        at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:175)
        at com.mchange.v2.c3p0.WrapperCo
    nnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:220)
        at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:206)
        at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:203)
        at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1138)
        at com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1125)
        at com.mchange.v2.resourcepool.BasicResourcePool.access$700(BasicResourcePool.java:44)
        at com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run(BasicResourcePool.java:1870)
        at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:696)
    Caused by: java.net.ConnectException: Connection refused (Connection refused)
        at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.
    base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399)
        at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242)
        at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224)
        at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:403)
        at java.base/java.net.Socket.connect(Socket.java:591)
        at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:211)
        at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:300)
        ... 20 more
    Dec 05, 2018 2:20:02 PM com.mchange.v2.resourcepool.BasicResourcePool
    WARNING: com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@1f7abf7 -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception:
    com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
    The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
        at jdk.internal.reflect.GeneratedConstructorAccessor7.newInstance(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
        at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:989)
        at
     com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:341)
        at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2203)
        at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2236)
        at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2035)
        at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:790)
        at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
        at jdk.internal.reflect.GeneratedConstructorAccessor5.newInstance(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
        at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:400)
        at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:330)
        at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:175)
        at com.mchange.v2.c3p0.WrapperC
    onnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:220)
        at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:206)
        at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:203)
        at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1138)
        at com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1125)
        at com.mchange.v2.resourcepool.BasicResourcePool.access$700(BasicResourcePool.java:44)
        at com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run(BasicResourcePool.java:1870)
        at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:696)
    Caused by: java.net.ConnectException: Connection refused (Connection refused)
        at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
        at java
    .base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399)
        at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242)
        at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224)
        at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:403)
        at java.base/java.net.Socket.connect(Socket.java:591)
        at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:211)
        at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:300)
        ... 20 more
    Dec 05, 2018 2:20:02 PM com.mchange.v2.resourcepool.BasicResourcePool
    WARNING: Having failed to acquire a resource, com.mchange.v2.resourcepool.BasicResourcePool@6cc338 is interrupting all Threads waiting on a resource to check out. Will try again in response to new client requests.
    Dec 05, 2018 2:20:02 PM com.mchange.v2.resourcepool.BasicResourcePool
    WARNING: Having failed to acquire a resource, com.mchange.v2.resourcepool.BasicResourcePool@6cc338 is interrupting all Threads waiting on a resource to check out. Will try again in response to new client requests.
    (TimeoutException) com.mchange.v2.resourcepool.TimeoutException: A client timed out while waiting to acquire a resource from com.mchange.v2.resourcepool.BasicResourcePool@6cc338 -- timeout at awaitAvailable()
    Dec 05, 2018 2:20:03 PM com.mchange.v2.resourcepool.BasicResourcePool
    WARNING: com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@129035c -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception:
    com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
    The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
        at jdk.internal.reflect.GeneratedConstructorAccessor7.newInstance(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
        at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:989)
        at
     com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:341)
        at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2203)
        at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2236)
        at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2035)
        at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:790)
        at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
        at jdk.internal.reflect.GeneratedConstructorAccessor5.newInstance(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
        at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:400)
        at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:330)
        at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:175)
        at com.mchange.v2.c3p0.WrapperC
    onnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:220)
        at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:206)
        at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:203)
        at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1138)
        at com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1125)
        at com.mchange.v2.resourcepool.BasicResourcePool.access$700(BasicResourcePool.java:44)
        at com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run(BasicResourcePool.java:1870)
        at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:696)
    Caused by: java.net.ConnectException: Connection refused (Connection refused)
        at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
        at java
    .base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399)
        at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242)
        at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224)
        at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:403)
        at java.base/java.net.Socket.connect(Socket.java:591)
        at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:211)
        at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:300)
        ... 20 more
    Dec 05, 2018 2:20:03 PM com.mchange.v2.resourcepool.BasicResourcePool
    WARNING: Having failed to acquire a resource, com.mchange.v2.resourcepool.BasicResourcePool@6cc338 is interrupting all Threads waiting on a resource to check out. Will try again in response to new client requests.
    Command: , took: 32982ms, client=10.100.102.1
    The additionaljars are
    Code:
    'Non-UI application (console / server application)
    #Region  Project Attributes
        
    #CommandLineArgs:
        
    #MergeLibraries: True
        
    #AdditionalJar: mysql-connector-java-5.1.41-bin
        
    #AdditionalJar: sqlite-jdbc-3.7.2
    Edit: another application with just #AdditionalJar: sqlite-jdbc-3.7.2 works fine.
     
    Last edited: Dec 5, 2018
  8. Erel

    Erel Administrator Staff Member Licensed User

    @derez please start a new thread for this.
     
Thread Status:
Not open for further replies.
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