|
| 1 | +banner() { |
| 2 | + echo " __ __ _ _____ _ " |
| 3 | + echo "| \/ |_ _ | | __ ___ ____ _ |_ _|__ ___ | |___ " |
| 4 | + echo "| |\/| | | | | _ | |/ _' \ \ / / _' | | |/ _ \ / _ \| / __| " |
| 5 | + echo "| | | | |_| | | |_| | (_| |\ V / (_| | | | (_) | (_) | \__ \ " |
| 6 | + echo "|_| |_|\__, | \___/ \__,_| \_/ \__,_| |_|\___/ \___/|_|___/ " |
| 7 | + echo " |___/ " |
| 8 | + echo "=============================================================== " |
| 9 | + echo -e " Coded By: Zavier \n" |
| 10 | +} |
| 11 | + |
| 12 | +pause() { |
| 13 | + read -s -n 1 -p "Press any key to continue . . ." |
| 14 | +} |
| 15 | + |
| 16 | +load() { |
| 17 | + clear |
| 18 | + banner |
| 19 | + echo "Menu : " |
| 20 | + echo "[1] Compile Java File" |
| 21 | + echo "[2] Make Dex File" |
| 22 | + echo "[3] Delete All Class Files" |
| 23 | + echo "[4] Run Java Program" |
| 24 | + echo "[#] Exit" |
| 25 | + echo "=========================" |
| 26 | + echo -n "-> " |
| 27 | + read Menu |
| 28 | + |
| 29 | + if [ $Menu = "1" ]; then |
| 30 | + clear |
| 31 | + banner |
| 32 | + java_files=$(ls *.java) |
| 33 | + echo -e "Current directory: $(pwd)\n" |
| 34 | + echo -e "List *.java files in directory : " |
| 35 | + for index in ${!java_files[@]}; do |
| 36 | + echo " [${index+1}] ${java_files[$index]}" |
| 37 | + done |
| 38 | + |
| 39 | + echo |
| 40 | + echo -n "Filename '.java' : "; |
| 41 | + read Filename |
| 42 | + |
| 43 | + directory_location=$(pwd) |
| 44 | + |
| 45 | + ecj "$directory_location/$Filename" |
| 46 | + pause |
| 47 | + load |
| 48 | + elif [ $Menu = "2" ]; then |
| 49 | + clear |
| 50 | + banner |
| 51 | + class_files=$(ls *.class) |
| 52 | + if [[ "No such file or directory" == *"$class_files"* ]]; then |
| 53 | + echo -e "Please compile java file frist !\n" |
| 54 | + pause |
| 55 | + load |
| 56 | + fi |
| 57 | + |
| 58 | + echo -e "Current directory: $(pwd)\n" |
| 59 | + echo -e "List *.class files in directory : " |
| 60 | + for index in ${!class_files[@]}; do |
| 61 | + echo " [${index+1}] ${class_files[$index]}" |
| 62 | + done |
| 63 | + |
| 64 | + echo -e "\nThis process will make output .jar and .dex files"; |
| 65 | + echo -e "Note: dex file and main class name should same\n" |
| 66 | + echo -n "Main Class Name : " |
| 67 | + read Filename |
| 68 | + |
| 69 | + zip "$Filename.jar" *.class |
| 70 | + dx --dex --output "$Filename.dex" "$Filename.jar" |
| 71 | + pause |
| 72 | + load |
| 73 | + elif [ $Menu = "3" ]; then |
| 74 | + clear |
| 75 | + banner |
| 76 | + file_location="$(pwd)/*.class" |
| 77 | + rm $file_location |
| 78 | + pause |
| 79 | + load |
| 80 | + elif [ $Menu = "4" ]; then |
| 81 | + clear |
| 82 | + banner |
| 83 | + dex_files=$(ls *.dex) |
| 84 | + if [[ "No such file or directory" == *"$dex_files"* ]]; then |
| 85 | + echo -e "Please create dex file frist !\n" |
| 86 | + pause |
| 87 | + load |
| 88 | + fi |
| 89 | + |
| 90 | + echo -e "Current directory: $(pwd)\n" |
| 91 | + echo -e "List *.dex files in directory : " |
| 92 | + for index in ${!dex_files[@]}; do |
| 93 | + echo " [${index+1}] ${dex_files[$index]}" |
| 94 | + done |
| 95 | + |
| 96 | + echo -e "\nNote: dex file and main class name should same\n" |
| 97 | + echo -n "Dex File : " |
| 98 | + read Filename |
| 99 | + |
| 100 | + clear |
| 101 | + dalvikvm -cp "$Filename.dex" "$Filename" |
| 102 | + elif [ $Menu = "#" ]; then |
| 103 | + exit |
| 104 | + else |
| 105 | + echo -e "\nSorry, system doesn't reconigze your input"; |
| 106 | + pause |
| 107 | + load |
| 108 | + fi |
| 109 | +} |
| 110 | + |
| 111 | +load |
0 commit comments