// If you use TextWrangler to edit java source code,
// this AppleScript will compile the front window.
tell application "TextWrangler"
set the_file to file of text document 1
set AppleScript's text item delimiters to ":"
set source_file to the last text item of (the_file as string)
tell application "Finder"
set the_folder to container of the_file as alias
tell application "Terminal"
set shell_script to "cd " & (quoted form of POSIX path of the_folder) & "; javac " & source_file
if (count windows) is 0 then
do script shell_script
do script shell_script in the front window