dotfiles-x11/.local/bin/jrun

15 lines
294 B
Bash
Executable File

#!/bin/env bash
# Script to run simple .java files.
# because its annoying to have .class files clutter your working directory;
if [ -z $* ]; then
echo "usage: jrun <filename>"
else
filename="${1%.*}"
\cp -f "$1" /tmp/"$1"
javac -d /tmp "$1"
java -cp /tmp "$filename"
fi