Install Java-17 on Android(Termux)!!

 1. Run the following command to install ubuntu on termux(if your Android version is <=6, if its >=7 its simple just two lines)


If You have Android version 6 or less run these commands




Then..

[Note: If any commands asks for superuser permission then run the command by prefixing with the keyword sudo (for example sudo apt update)]

First check for java-17 package by typing 

apt update -y

apt upgrade -y

apt search openjdk-17

If their is a package then install it by typing

apt install openjdk-17-jre-headless openjdk-17-jdk-headless #or type the package name appeared in the search


If You have Android version 7 or above run these commands


termux-change-repo

select all three options and then ok and select the last(BFSU) one and press ok.

pkg update && pkg upgrade

If any prompt occurs just type y<ENTER>

pkg install openjdk-17 #as simple as that



Install a text editor
You can either use vim or nano
apt install vim #for vim
apt install nano #for nano

Test using
java --version
javac --version
To run java file type
javac [filename].java
java [filename]

Comments

Popular Posts