### Java Install/Update

Hints for using Java on the Raspberry Pi (RPi).
Java Installation / Update
(Example using Java version 1.8.0_131)
Download and unpack Java JDK
Logon to the Raspberry Pi as User Pi.
Create folder: mkdir /home/pi/java.
Set folder: cd /home/pi/java.
Download from Oracle jdk-8u131-linux-arm32-vfp-hflt.tar.gz or higher version if available.
Copy jdk-8u131-linux-arm32-vfp-hflt.tar.gz to /home/pi/java:
cp jdk-8u131-linux-arm32-vfp-hflt.tar.gz /home/pi/java
Unpack jdk-8u131-linux-arm32-vfp-hflt.tar.gz to /opt:
sudo tar zxvf jdk-8u131-linux-arm32-vfp-hflt.tar.gz -C /opt
Set Java Alternatives
sudo update-alternatives --install /usr/bin/javac javac /opt/jdk1.8.0_131/bin/javac 1
sudo update-alternatives --install /usr/bin/java java /opt/jdk1.8.0_131/bin/java 1
sudo update-alternatives --config javac
There are various choices, depending how many java versions are installed, for the alternative javac (providing /usr/bin/javac):
Select choice for jdk1.8.0_152 resulting in message below.
update-alternatives: using /opt/jdk1.8.0_152/bin/javac to provide /usr/bin/javac (javac) in manual mode
sudo update-alternatives --config java
There are , depending how many java versions are installed, for the alternative java (providing /usr/bin/java):
Select for jdk1.8.0_152 resulting in message below.
update-alternatives: using /opt/jdk1.8.0_152/bin/java to provide /usr/bin/java (java) in manual mode
Check the Java versions
java -version
Resulting in:
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) Client VM (build 25.131-b11, mixed mode)
javac -version
javac 1.8.0_131

Changed: 2017-11-10 09:42, Category: Raspberry Pi, File: T6C234M1713.htm, ID: 1713