### Installation

Example Installation steps for Java and JavaFXPorts on a Raspberry Pi.
Status: 20170723.
Note:
The versions used below are JDK1.8.0_141 and Gluon JavaFXPorts 8.60.8.
But also tested (20180327) on a RPi 3 Model B+ running Stretch, JDK1.8.0_162, Gluon JavaFXPorts armv6hf-sdk-8.60.9.
Installation JDK v8u141
Download and unpack Java JDK
Download Url (Java 8): http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Logon to the Raspberry Pi as User Pi.
Create folder: mkdir /home/pi/java.
Set folder: cd /home/pi/java.
Download from Oracle jdk-8u141-linux-arm32-vfp-hflt.tar.gz or higher version if available.
Copy jdk-8u141-linux-arm32-vfp-hflt.tar.gz to /home/pi/java:
cp jdk-8u141-linux-arm32-vfp-hflt.tar.gz /home/pi/java
Unpack jdk-8u141-linux-arm32-vfp-hflt.tar.gz to /opt:
sudo tar zxvf jdk-8u141-linux-arm32-vfp-hflt.tar.gz -C /opt
Set Java Alternatives
sudo update-alternatives --install /usr/bin/javac javac /opt/jdk1.8.0_141/bin/javac 1
sudo update-alternatives --install /usr/bin/java java /opt/jdk1.8.0_141/bin/java 1
sudo update-alternatives --config javac
There are 2 choices for the alternative javac (providing /usr/bin/javac):
Select choice 1, resulting in message below.
update-alternatives: using /opt/jdk1.8.0_141/bin/javac to provide /usr/bin/javac (javac) in manual mode
Note: depending installations, there might be more choices. Ensure to select the highest version.
sudo update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java):
Select choice 1, resulting in message below.
update-alternatives: using /opt/jdk1.8.0_141/bin/java to provide /usr/bin/java (java) in manual mode
Check Java Run Time and Java Compiler Version
Run from the command line:
java -version
Output:
java version "1.8.0_141"
Java(TM) SE Runtime Environment (build 1.8.0_141-b15)
Java HotSpot(TM) Client VM (build 25.141-b15, mixed mode)
javac -version
Output:
javac 1.8.0_141
Example Log for installating Java 8u141
pi@raspberrypi:~ $ cd /home/pi/java
pi@raspberrypi:~/java $ ls
jdk-8u141-linux-arm32-vfp-hflt.tar.gz
pi@raspberrypi:~/java $ sudo tar zxvf jdk-8u141-linux-arm32-vfp-hflt.tar.gz -C /opt
jdk1.8.0_141/COPYRIGHT
jdk1.8.0_141/LICENSE
jdk1.8.0_141/README.html
... AND MANY MORE FILES
pi@raspberrypi:~/java $ sudo update-alternatives --install /usr/bin/javac javac /opt/jdk1.8.0_141/bin/javac 1
pi@raspberrypi:~/java $ sudo update-alternatives --install /usr/bin/java java /opt/jdk1.8.0_141/bin/java 1
pi@raspberrypi:~/java $ sudo update-alternatives --config javac
There are 3 choices for the alternative javac (providing /usr/bin/javac).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/bin/javac 318 auto mode
• 1 /opt/jdk1.8.0_131/bin/javac 1 manual mode
2 /opt/jdk1.8.0_141/bin/javac 1 manual mode
3 /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/bin/javac 318 manual mode
Press enter to keep the current choice[*], or type selection number: 2
update-alternatives: using /opt/jdk1.8.0_141/bin/javac to provide /usr/bin/javac (javac) in manual mode
pi@raspberrypi:~/java $ sudo update-alternatives --config java
There are 3 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/bin/java 318 auto mode
• 1 /opt/jdk1.8.0_131/bin/java 1 manual mode
2 /opt/jdk1.8.0_141/bin/java 1 manual mode
3 /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/bin/java 318 manual mode
Press enter to keep the current choice[*], or type selection number: 2
update-alternatives: using /opt/jdk1.8.0_141/bin/java to provide /usr/bin/java (java) in manual mode
pi@raspberrypi:~/java $ java -version
java version "1.8.0_141"
Java(TM) SE Runtime Environment (build 1.8.0_141-b15)
Java HotSpot(TM) Client VM (build 25.141-b15, mixed mode)
pi@raspberrypi:~/java $ javac -version
javac 1.8.0_141
pi@raspberrypi:~/java $
Installation JavaFXPorts v8.60.8
Copy JavaFXPorts Files
Create folder /home/pi/java/.
Download from Gluon armv6hf-sdk-8.60.8.zip or higher version if available.
(See http://gluonhq.com/products/mobile/javafxports/get/ , select JavaFX Embedded SDK )
Extract the Zip file, resulting in folder structure /home/pi/java/armv6hf-sdk/...
Copy the required files:
sudo cp /home/pi/java/armv6hf-sdk/rt/lib/ext/jfxrt.jar /opt/jdk1.8.0_141/jre/lib/ext/
sudo cp /home/pi/java/armv6hf-sdk/rt/lib/arm/* /opt/jdk1.8.0_141/jre/lib/arm/
sudo cp /home/pi/java/armv6hf-sdk/rt/lib/javafx.platform.properties /opt/jdk1.8.0_141/jre/lib
sudo cp /home/pi/java/armv6hf-sdk/rt/lib/javafx.properties /opt/jdk1.8.0_141/jre/lib
sudo cp /home/pi/java/armv6hf-sdk/rt/lib/jfxswt.jar /opt/jdk1.8.0_141/jre/lib
Check libpango and libgtk2
(when using the latest Raspian Jessie these should be up-to-date).
sudo apt-get install libpango-1.0-0:armhf libpangoft2-1.0-0:armhf
sudo apt install libgtk2.0-0
Install the B4J bridge
Create a folder /home/pi/b4j
Set the folder: cd /home/pi/b4j
Get the B4J Bridge:
wget http://www.basic4ppc.com/b4j/files/b4j-bridge.jar
Note: ensure to delete any previous bridge file, else the new bridge file is copied to b4-bridge.jar.1.
Test the B4J Bridge
Start the B4J-Bridge (to test if the application is running) in a terminal (opened via WinSCP with Ctrl-P or use PuTTy):
sudo java -jar b4j-bridge.jar
B4J-Bridge v1.20
Waiting for connections (port=6790)...
My IP address is: 192.168.0.21
FTP Server started: ftp://192.168.0.21:6781
Start B4J-Bridge with -disableftp to disable.
Connected!
Starting program

Changed: 2018-05-04 15:28, Category: Raspberry Pi UI JavaFXPorts, File: T6C239M1750.htm, ID: 1750