Skip to content

Instantly share code, notes, and snippets.

@TonyWhite
Created March 1, 2018 09:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TonyWhite/3fc2ea416304a5eef35b2995bb8cc24c to your computer and use it in GitHub Desktop.
Save TonyWhite/3fc2ea416304a5eef35b2995bb8cc24c to your computer and use it in GitHub Desktop.
HomeJar - Execute a jar file in Linux Home directory
[Desktop Entry]
Name=HomeJar
Comment=Jar executor in Home directory
Exec=homejar %f
Icon=homejar.svg
Terminal=false
Type=Application
Categories=Settings;System;
StartupNotify=false
MimeType=x-java-archive;
#!/bin/bash
# Execute a jar file in Home directory
file_name=${1}
if [ ${file_name} ]; then
if [ -s ${file_name} ]; then
# Navigate to home
cd ~
# Execute file
java -jar ${file_name}
else
echo "ERROR 404 \"${file_name}\" NOT FOUND"
fi
else
echo "Need for Jar file"
fi
exit
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# Need root access
if (( $EUID != 0 )); then
echo "Please run as root"
exit
fi
# Install script
cp homejar.sh /usr/bin/homejar
# Add desktop entries
cp homejar.desktop /usr/share/applications/homejar.desktop
# Install icon
cp homejar.svg /usr/share/pixmaps/homejar.svg
# Need root access
if (( $EUID != 0 )); then
echo "Please run as root"
exit
fi
# uninstall script
rm /usr/bin/homejar
# Remove desktop entries
rm /usr/share/applications/homejar.desktop
# Uninstall icon
rm /usr/share/pixmaps/homejar.svg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment