how can I install java runtime on Android device?
Solution 1
Try Termux, a linux terminal emulator for android.A minimal base system is installed automatically - additional packages are available using the APT package manager. You can use following commands to install java8.
- pkg install git
- git clone https://github.com/MasterDevX/Termux-Java.git
- cd Termux-Java
- chmod +x installjava
- bash installjava
When installed, run java -version to check, if it's correcty installed. After that you can run java using Java command.
Solution 2
$ apt update && apt upgrade $ apt install openjdk-17
Solution 3
First of all install termux. Then run following commands :
$ pkg update -y && pkg upgrade -y
$ termux-setup-storage
And give the storage permission. After that download these 2 files.
Remember the filenames, and the folder where you downloaded the files.
Go back to termux and run :
$ cd /sdcard/<folder name>
Replace foldername with your download folder.
$ mv file1 file2 $HOME
Replace file1 and file2 with actual filenames.
Alternative :
If you don’t want to download and move files manually you can use this commands (not recommended) :
$ pkg install wget -y
$ wget https://archive.org/download/openjdk-9-jre-headless_9.2017.8.20-1_x86_64/openjdk-9-jdk-headless_9.2017.8.20-1_arm.deb
$ wget https://archive.org/download/openjdk-9-jre-headless_9.2017.8.20-1_x86_64/openjdk-9-jre-headless_9.2017.8.20-1_arm.deb
It will download files within your termux home directory.
Finally run,
$ apt-get install -y ./openjdk-9-jdk-headless_9.2017.8.20-1_arm.deb
$ apt-get install -y ./openjdk-9-jre-headless_9.2017.8.20-1_arm.deb
And You're done.
Try typing java
or javac
.
If you don’t see an Error you're good to go.
Azzurro94
Updated on June 05, 2022Comments
-
Azzurro94 almost 2 years
I need to install some packages and Linux programs on my android devices. for example I want to use something similar YUM or get-apt command (I know these are Linux Commands) through windows powershell connected to my android device. but it does not recognize these commands. even ADB does not work, e.g. adb update -y is unknown command. How can i do this, is it possible. if the android kernel is linux so I guess there must be a way. I checked this but didnt help me:
Is it possible to install the JDK on an android device?
Thanks
EDITED: I used the link below , thanks to my friend for good answer. this is the command i used :
pkg install wget && wget https://raw.githubusercontent.com/MasterDevX/java/master/installjava && bash installjava
BUT when i run java command it says "Killed". No Idea!