How to Install Java (Open-JDK-8) in Termux
Method 1: Java 8 Installation
Introduction
Install Java (Open-JDK-8) in Termux without rooting your Android device. Follow these steps to get Java up and running in your Termux environment.
Step-by-Step Guide
Step 1: Install Kali Linux in Termux (Optional)
pkg install wget proot -y && wget https://raw.githubusercontent.com/MasterDevX/KaliTermux/master/InstallKali.sh && bash InstallKali.sh
Step 2: Download OpenJDK-8-JRE Deb Package
Visit ftp.debian and copy the link to the OpenJDK-8-JRE deb package.
Step 3: Download Deb Package in Kali Machine
wget http://ftp.debian.org/debian/pool/main/o/openjdk-8/openjdk-8-jre-headless_8u275-b01-1_arm64.deb

Step 4: Install Deb Package Manually
dpkg -i openjdk-8-jre-headless_8u275-b01-1_arm64.deb

Step 5: Change Java Version (Optional)
sudo update-alternatives --config java

Final Step: Verify Java Version
Select the desired Java version (in this case, Java 8) by typing the corresponding number.

Other Methods
Method 2: Using Termux Repository
- Update Termux:
apt update
- Install dependencies:
apt install wget dirmngr gnupg-curl -y
- Add repository:
mkdir -p $PREFIX/etc/apt/sources.list.d && echo "deb https://termux.xeffyr.ml/ extra main x11" > $PREFIX/etc/apt/sources.list.d/list.list
- Update Termux:
apt update
- Install OpenJDK-9-JDK:
apt install openjdk-9-jdk-headless -y
Troubleshooting
If you encounter any issues, try the alternative method or seek help from the Termux community.