Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Compile The Front TextWrangler Java Source File Using Applescript

DZone's Guide to

Compile The Front TextWrangler Java Source File Using Applescript

·
Free Resource
// 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
end tell

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
end tell

tell application "Terminal"
	activate
	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
	else
		do script shell_script in the front window
	end if
end tell
Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}