Here is the AppleScript that will close Java programs,
tell application "Terminal"
do shell script "ps ax | grep \"java.*$1\" | grep -v grep | awk '{ print \"kill \" $1 }' | sh"
quit
end tell
*Reference: MAC OS - Is there a way to close a Java program?
Thanks to: wojciechka ♦♦*