Skip to content

Instantly share code, notes, and snippets.

@zmarvel
Created February 24, 2015 23:57
Show Gist options
  • Save zmarvel/7d7ca19d0142bc9ed7bc to your computer and use it in GitHub Desktop.
Save zmarvel/7d7ca19d0142bc9ed7bc to your computer and use it in GitHub Desktop.
Find all java classes from the current directory and execute them
#!/bin/bash
DIR=$( pwd )
CLASSES=$( find -name '*.class' -print )
for file in $CLASSES; do
filedir=$( dirname $file )
filename=$( basename $file | sed s/.class// )
echo Changing to $filedir
cd $filedir
echo Executing $filename
java $filename
echo Changing back to $DIR
cd $DIR
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment