[Tool] Look4How Viewer Raspberry Pi (B4J, Liberica JDK)

Programming helpers.
rwblinn
Site Admin
Posts: 224
Joined: 07 Oct 2017, 12:16

[Tool] Look4How Viewer Raspberry Pi (B4J, Liberica JDK)

Postby rwblinn » 07 May 2018, 12:18

Look4How Viewer for the Raspberry Pi
Database: SQLite. Example database used B4JHowTo.l4h.
Tools: B4J v6.01, Liberica JDK v10.0.1, Raspberry Pi 3B+ running Stretch
Author: Robert W.B. Linn @ http://www.rwblinn.de
Version: 20180507

Intro
The goal is to view the content of Look4How databases (SQLite) on a Raspberry Pi by using B4J and Liberica JDK.
This application is just out of curiosity if the Liberica JDK can be used with B4J.
The viewer should have a GUI (Graphical User Interface) using the JDK.
The item (category, memo) content to be displayed as plain text because the WebKit is (currently) not supported by the Liberica JDK v10 (this might change, watch the Liberica developments).

Download
B4J Source.
Note: The folder libraries contains sqlite-raspberry.jar required to run on the Raspberry Pi. Copy the jar tothe B4J additional libraries folder.

Snapshot
Image
Look4How viewer running on a Raspberry Pi 3B+ Stretch - Fullscreen mode.

GUI Layout
The GUI layout is rather simple with a menu to open a database, list views for the themes and items and a textarea to view the content.
Options to copy the content and set text wrapping, select a Look4How database and show information about the application.
[MenuBar]
[Listview Themes][TextArea Content]
[Listview Items]

Run
After loading the project file l4hviewer.l4h into the B4J IDE, test the application. The default database is B4JHowTo.l4h with more then 1000 items.
PC
To test on a PC, need to set the conditional symbol PC (Menu > Project > Build Configurations > Conditional Symbols).
Do not connect to the Raspberry Pi B4J-Bridge.

Raspberry Pi
Tested on Raspberry Pi use the B4J-Bridge. Ensure to copy a Look4How database file (.l4h) to the folder tempjars.
Do not set the conditional symbol PC. Set GPU memory to 512 (Raspberry Pi IDE > Preferences).
The application is running on the Raspberry Pi, but bit slow for large database (i.e. more then 1000 items).

Liberica JDK Information
As taken from here, Liberica is a 100% open-source Java 10 implementation for Raspberry Pi. It is built from OpenJDK which BellSoft contributes.
Tested the Liberica JDK DEB package (Linux ARMv7&8 32 Bit HardFloat) on a Raspberry Pi 3B+ with Stretch (Linux raspberrypi 4.14.30-v7+ #1102 SMP Mon Mar 26 16:45:49 BST 2018 armv7l).

Liberica JDK Installation
Steps to install v10. In the mean time v10.0.0.1 is available.
Login as user pi.
// Create a folder to store the downloads and for the test applications.
$mkdir /home/pi/java

// Set the java folder as default
$cd /home/pi/java

// Download the Liberica JDK10 package from BellSoft
$ wget https://github.com/bell-sw/Liberica/rel ... p-hflt.deb
Logging information snippet ...
--2018-04-18 09:33:42-- https://github.com/bell-sw/Liberica/rel ... p-hflt.deb
Saving to: ‘bellsoft-jdk10-linux-arm32-vfp-hflt.deb’
bellsoft-jdk10-linu 100%[===================>] 209.58M 752KB/s in 4m 48s
2018-04-18 09:38:31 (745 KB/s) - ‘bellsoft-jdk10-linux-arm32-vfp-hflt.deb’ saved [219758630/219758630]

// Install the Liberica JDK10 package
$sudo apt install ./bellsoft-jdk10-linux-arm32-vfp-hflt.deb
Logging information snippet ...

// Check the installed java and javac versions
$ java -version
java version "1.8.0_162"
$ javac -version
javac 1.8.0_162

// Set the right javac version
$sudo update-alternatives --config javac
There are 4 choices for the alternative javac (providing /usr/bin/javac) - the number of choices depends on the Java installations.
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/jdk-10-bellsoft-arm32-vfp-hflt/bin/javac 1902 auto mode
1 /opt/jdk1.8.0_161/bin/javac 1 manual mode
* 2 /opt/jdk1.8.0_162/bin/javac 1 manual mode
3 /usr/lib/jvm/jdk-10-bellsoft-arm32-vfp-hflt/bin/javac 1902 manual mode
4 /usr/lib/jvm/jdk-7-oracle-arm-vfp-hflt/bin/javac 317 manual mode
Press <enter> to keep the current choice[*], or type selection number: 3
update-alternatives: using /usr/lib/jvm/jdk-10-bellsoft-arm32-vfp-hflt/bin/javac to provide /usr/bin/javac (javac) in manual mode

// Set the right java version
$sudo update-alternatives --config java
There are 4 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/jdk-10-bellsoft-arm32-vfp-hflt/bin/java 1902 auto mode
1 /opt/jdk1.8.0_161/bin/java 1 manual mode
* 2 /opt/jdk1.8.0_162/bin/java 1 manual mode
3 /usr/lib/jvm/jdk-10-bellsoft-arm32-vfp-hflt/bin/java 1902 manual mode
4 /usr/lib/jvm/jdk-7-oracle-arm-vfp-hflt/jre/bin/java 317 manual mode
Press <enter> to keep the current choice[*], or type selection number: 3
update-alternatives: using /usr/lib/jvm/jdk-10-bellsoft-arm32-vfp-hflt/bin/java to provide /usr/bin/java (java) in manual mode

// Check the java and javac versions again = should be the BellSoft versions
$javac -version
javac 10-BellSoft

$java -version
openjdk version "10-BellSoft" 2018-03-20
OpenJDK Runtime Environment (build 10-BellSoft+0)
OpenJDK Server VM (build 10-BellSoft+0, mixed mode)
pi@raspberrypi:~/java $

Installation Folder
The JDK is installed in folder: /usr/lib/jvm/jdk-10-bellsoft-arm32-vfp-hflt
Recommend to read the file readme.txt. The file release contains release version and module information.

Return to “Tools”



Who is online