How to Install Java (OpenJDK 8) in Termux
Method 1: Java 8 Installation
Introduction
This method explains how to install Java (OpenJDK 8) in Termux without rooting your Android device.
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 the Debian FTP repository and copy the link to the OpenJDK 8 JRE package.
ftp.debian
Step 3: Download the Deb Package in Kali
wget http://ftp.debian.org/debian/pool/main/o/openjdk-8/openjdk-8-jre-headless_8u275-b01-1_arm64.deb
Step 4: Install the 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 (Java 8) by entering the corresponding number when prompted, then verify:
java -version
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 again:
apt update -
Install OpenJDK:
apt install openjdk-9-jdk-headless -y
Troubleshooting
If you encounter issues, try the alternative method or seek help from the Termux community.
Related Articles
- How to download and set up vShell Android app for the first time