Skip to content

Instantly share code, notes, and snippets.

@pforhan
pforhan / ExtractMavenModules.java
Created Oct 1, 2013
Selectively build maven modules based on the changes in the git workspace.
View ExtractMavenModules.java
/*bin/echo Running $0 > /dev/null
filename=`basename "$0"`
mytmpdir=/tmp/$filename
classname=${filename%.*}
if [ $0 -nt $mytmpdir/$classname.class ]
then
echo Compiling $0 > /dev/null
mkdir $mytmpdir 2> /dev/null
javac -d $mytmpdir $0 || exit
fi
@pforhan
pforhan / JavaShellScript.java
Last active Dec 18, 2015
Runs a Java source file right from a BASH shell. Remember to chmod a+x your .java!
View JavaShellScript.java
/*bin/echo Running $0
filename=`basename "$0"`
classname=${filename%.*}
if [ $0 -nt /tmp/$filename/$classname.class ]
then
echo Compiling $0
mkdir /tmp/$filename 2> /dev/null
javac -d /tmp/$filename $filename || exit
fi
java -cp /tmp/$filename $classname "$@"