-
-
Save OrenBochman/71c8d78e774f5bccedc9324963a7434c to your computer and use it in GitHub Desktop.
Script to Setup JAVA (on rapberry, beaglebone, etc...)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DFILE=`find -name "*arm*.tar.gz"` | |
echo "Found: " $DFILE | |
if [ -z "$DFILE" ]; then | |
echo "ERROR: Please download JRE/JDK and put in current directory" | |
exit 1 | |
fi | |
if grep -Fq "JAVA_HOME" ~/.profile | |
then | |
echo "ERROR: already found another installed version on ~/.profile, remove first" | |
exit 1 | |
fi | |
mkdir /opt/java | |
tar -zxvf $DFILE -C /opt/java | |
JAVA_HOME=`ls -d /opt/java/*` | |
echo "Installed on: " $JAVA_HOME | |
export PATH=$PATH:$JAVA_HOME/bin | |
export JAVA_HOME=$JAVA_HOME | |
# Install on Profile | |
echo "export JAVA_HOME=$JAVA_HOME" >> ~/.profile | |
echo "export PATH=\$PATH:$JAVA_HOME/bin/" >> ~/.profile | |
echo "Finished ! Logout or run those commands:" | |
echo "==========================================" | |
echo "export JAVA_HOME=$JAVA_HOME" | |
echo "export PATH=\$PATH:$JAVA_HOME/bin/" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment