Skip to content

A lot of changes! #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
tasks:
- init: echo "I hope you realized that GitPod is the last needed thing in Termux packages development and you have no point in being here, right?"
image: gitpod/workspace-full
28 changes: 22 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
# Java for termux
# Steps
1.mv java/openjdk/java /data/data/com.termux/files/usr/bin
[![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code%20(for%20some%20reason)-blue?logo=gitpod)](https://gitpod.io/#https://github.com/MasterDevX/Termux-Java)

2.Now you can execute java
# Termux Java

# Hello I am Lokesh (devil - admin of hax4us channel & website )
### Information

# This is a try to use java easily in termux plz dont put my hardwork into dustbean by copying my work :D thnx
This script will install Java in Termux.

Libraries compiled by [Hax4us](https://github.com/Hax4us "Hax4us's GitHub profile"), scripts written by [Hax4us](https://github.com/Hax4us "Hax4us's GitHub profile"), [MasterDevX](https://github.com/MasterDevX "MasterDevX's GitHub profile") and [Guzio](https://github.com/GuzioMG "Guzio's GitHub profile"), with some *very, very tiny* help from [Harshiv-Patel](https://Harshiv-Patel "he changed like... one thing").

### How to use

To install Java, open Termux and execute the following command:

```pkg install wget && wget https://raw.githubusercontent.com/MasterDevX/java/master/installjava && bash installjava```

> Eventually, run ```wget https://raw.githubusercontent.com/MasterDevX/java/master/installjava && bash installjava``` to install Java if you arleady have ```wget``` installed.

> Or just ```bash installjava``` if you have the script arleady downloaded for some reason.

When installed, run ```java -version``` to check, if it's correcty installed (i.e. if it throws command not found error, it's clearly not.)

After that you can run Java using ```java``` command.

We also provide an uninstaller, but since I'm writing this while making that script, there's no way I can attach a command here, as I need a link for that. Anyway, look for ```uninstall_java.sh``` in repo's home.
141 changes: 57 additions & 84 deletions installjava
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,92 +1,65 @@
#!/data/data/com.termux/files/usr/bin/bash
clear
sleep 0

#Setup
set -e
shopt -s expand_aliases
alias ee='echo -e'
ee " \033[33m----------------------------\033[0m"
ee" \033[36mLokesh:Hax4Us:€|eViL"
ee" \033[33m----------------------------\033[0m"
echo
ee" \033[36mJava Installation Script v1.0"
ee " \033[33m ----------------------------------"
echo
ee " \033[31mDon't take credits :D (Shared libraries are compiled by me)"
ee "\033[33m ------------------------------------"

arch=`dpkg --print-architecture`

echo "Do you want to continue (y|Y/n|N)"
read yesorno
if [ $yesorno = 'y' -o $yesorno = 'Y' ] ; then
echo "Package size is around 70mb before extraction"
#Greetings
echo
else
ee "\033[35mbye bye ... :D\033[0m"
exit
fi
if [ $arch = "aarch64" -o $arch = "arm64" ] ; then

ee "\033[32m[*] Now wait until jdk-8 is installing ...🕛🕧\033[0m"
echo

wget https://github.com/Hax4us/java/releases/download/v8/jdk8_aarch64.tar.gz

ee "\e[93mThis script will install Java in Termux."
ee "\e[93mLibraries compiled by \e[32mHax4us\e[93m, script written by \e[32mHax4us \e[93mand \e[32mMasterDevX\e[93m."
echo
ee "\033[32m[*] Moving jdk into system ...\033[0m"
mv jdk8_aarch64.tar.gz $PREFIX/share

ee "\033[32m[*] Extracting ...\033[0m"
cd $PREFIX/share
tar -xhf jdk8_aarch64.tar.gz

ee "\033[32m[*] Moving wrapper scripts for java 8\033[0m"
mv bin/* $PREFIX/bin

ee "\033[34mHappy java :D\033[0m"

elif [ $arch = "armhf" -o $arch = "armv7l" ]; then
echo "armhf"
ee "\033[32m[*] Now wait until jdk-8 is installing ...🕛🕧\033[0m"
echo

wget https://github.com/Hax4us/java/releases/download/v8-151/jdk8_arm.tar.gz

echo
ee "\033[32m[*] Moving jdk into system ...\033[0m"
mv jdk8_arm.tar.gz $PREFIX/share
echo
ee "\033[32m[*] Extracting ...\033[0m"
cd $PREFIX/share
tar -xhf jdk8_arm.tar.gz
echo
ee "\033[32m[*] Moving wrapper scripts for java 8\033[0m"
mv bin/* $PREFIX/bin
rm -rf $PREFIX/share/bin
echo
ee "\033[34mHappy java :D\033[0m"


elif [ $arch = "arm" ]; then
ee "\033[32m[*] Now wait until jdk-8 is installing ...🕛🕧\033[0m"
echo

wget https://github.com/Hax4us/java/releases/download/v8-151/jdk8_arm.tar.gz

echo
ee "\033[32m[*] Moving jdk into system ...\033[0m"
mv jdk8_arm.tar.gz $PREFIX/share
echo
ee "\033[32m[*] Extracting ...\033[0m"
cd $PREFIX/share
tar -xhf jdk8_arm.tar.gz
echo
ee "\033[32m[*] Moving wrapper scripts for java 8\033[0m"
mv bin/* $PREFIX/bin
rm -rf $PREFIX/share/bin
echo
ee "\033[34mHappy java :D\033[0m"


else
ee "\033[31munknown architecture :( plz contact @hax4us for more info\033[0m"
#Checking for existing Java installation
if [ -e $PREFIX/bin/java ]
then
ee "\e[32mJava is already installed!"
echo
exit
else
#Checking, whether is someone trying to cheat and simplyfy their installation it on Linux (i.e. x86 (not listad, as you can see) machine) using this script, which have no reason to work.
case `dpkg --print-architecture` in
aarch64)
archname="aarch64"; tag="v8" ;;
arm64)
archname="aarch64"; tag="v8" ;;
armhf)
archname="arm"; tag="v8-151" ;;
armv7l)
archname="arm"; tag="v8-151" ;;
arm)
archname="arm"; tag="v8-151" ;;
*)
ee "\e[91mERROR: Unknown architecture."; echo; exit ;;
esac

#Actual installation
ee "\e[32m[*] \e[34mDownloading JDK-8 (~70Mb) for ${archname}... 🕛This will take some time, so better make a coffee.🕛"
wget https://github.com/Hax4us/java/releases/download/${tag}/jdk8_${archname}.tar.gz -q

ee "\e[32m[*] \e[34mMoving JDK to system..."
mv jdk8_${archname}.tar.gz $PREFIX/share

ee "\e[32m[*] \e[34mExtracting JDK..."
cd $PREFIX/share
tar -xhf jdk8_${archname}.tar.gz

ee "\e[32m[*] \e[34mSeting-up %JAVA_HOME%..."
export JAVA_HOME=$PREFIX/share/jdk8
echo "export JAVA_HOME=$PREFIX/share/jdk8" >> $HOME/.profile

ee "\e[32m[*] \e[34mCoping Java wrapper scripts to bin..."
#I'm not 100% sure, but getting rid of bin contnent MAY cause some issues with %JAVA_HOME%, thus it's no longer moved - copied instead. Sorry to everyone short on storage.
cp bin/* $PREFIX/bin

ee "\e[32m[*] \e[34mCleaning up temporary files..."
rm -rf $HOME/installjava
rm -rf $PREFIX/share/jdk8_${archname}.tar.gz
rm -rf $PREFIX/share/bin

echo
ee "\e[32mJava was successfully installed!\e[39m"
echo "Enjoy your new, tasty Java :D (and a coffee, if you didn't drink it yet)"
echo
fi
4 changes: 2 additions & 2 deletions openjdk/java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#export LD_LIBRARY_PATH=/data/data/per.pqy.apktool/apktool/lix
#in some targets,LD_PRELOAD will cause a error.
export LD_PRELOAD=
export LD_LIBRARY_PATH=/data/data/com.termux/files/home/java/openjdk/lib/arm:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$HOME/java/openjdk/lib/arm:$LD_LIBRARY_PATH
#umask 000
#cd /data/data/per.pqy.apktool/apktool
#echo $$ > pid
exec /data/data/com.termux/files/home/java/openjdk/bin/java -Xmx1024m "$@"
exec $HOME/java/openjdk/bin/java -Xmx1024m "$@"
37 changes: 37 additions & 0 deletions uninstall_java.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/data/data/com.termux/files/usr/bin/bash

#Setup
shopt -s expand_aliases
alias ee='echo -e'

#Greetings
echo
ee "\e[93mThis script will uninstall Java from Termux."
echo

#Checking for existing Java installation
if [ ! -e $PREFIX/bin/java ]
then
ee "\e[32mJava is not installed!"
echo
exit
else
#Actual uninstallation
ee "\e[32m[*] \e[34mUnseting %JAVA_HOME%..."
unset JAVA_HOME=$PREFIX/share/jdk8
echo "WARNING! THIS SCRIPT WILL UNSET THE %JAVA_HOME% ONLY TEMPORARILY! I STRONGLY RECOMEND YOU TO REMOVE \"export JAVA_HOME=$PREFIX/share/jdk8\" LINE FROM YOUR \"$HOME/.profile\" SETUP FILE, AS NOT DOING THAT WILL CAUSE PROBLEMS IN SOME APPS!"

ee "\e[32m[*] \e[34mRemoving Java..."
rm -drf $PREFIX/share/jdk8
rm $PREFIX/bin/jar
rm $PREFIX/bin/jarsigner
rm $PREFIX/bin/java
rm $PREFIX/bin/javac
rm $PREFIX/bin/javadoc
rm $PREFIX/bin/javah
rm $PREFIX/bin/javap

echo
ee "\e[32mJava was successfully uninstalled!\e[39m"
echo
fi