# Source: https://github.com/alghanmi/ubuntu-desktop_setup
# Extract files
sudo tar zxvf ~/Downloads/eclipse-*.tar.gz -C /opt/ &&
# Change ownership to root
sudo chown -R root:root /opt/eclipse/ &&
# Create launch script in /usr/local/bin
echo '#!/bin/sh' | sudo tee /usr/local/bin/eclipse &&
echo 'export ECLIPSE_HOME="/opt/eclipse"' | sudo tee -a /usr/local/bin/eclipse &&
echo '$ECLIPSE_HOME/eclipse $*' | sudo tee -a /usr/local/bin/eclipse &&
sudo chmod 755 /usr/local/bin/eclipse &&
# Create menu entry
echo "[Desktop Entry]" | tee ~/.local/share/applications/eclipse.desktop &&
echo "Encoding=UTF-8" | tee -a ~/.local/share/applications/eclipse.desktop &&
echo "Name=Eclipse IDE" | tee -a ~/.local/share/applications/eclipse.desktop &&
echo "Comment=Integrated Development Environment" | tee -a ~/.local/share/applications/eclipse.desktop &&
echo "Exec=/usr/local/bin/eclipse" | tee -a ~/.local/share/applications/eclipse.desktop &&
echo "Icon=/opt/eclipse/icon.xpm" | tee -a ~/.local/share/applications/eclipse.desktop &&
echo "Categories=Development;IDE;Java;" | tee -a ~/.local/share/applications/eclipse.desktop &&
echo "Terminal=false" | tee -a ~/.local/share/applications/eclipse.desktop &&
echo "Type=Application" | tee -a ~/.local/share/applications/eclipse.desktop &&
echo "StartupNotify=true" | tee -a ~/.local/share/applications/eclipse.desktop &&
# Delete Eclipse download
rm ~/Downloads/eclipse-*.tar.gz