Controlling Your Mac with AppleScript and Java
Subject:   How to do AppleScript in Pure Java
Date:   2003-02-25 17:34:47
From:   anonymous2
If you don't want to bother with cocoa, it's also possible to use AppleScript in a Pure Java program. the key thing is the command line program "osascript", which takes in an applescript file (or stdin). Thus you can use the standard java "Runtime" class and pass in the script, followed by EOF, to stdin and it will do the same.
I use this sometimes to remotely control my mac without java, as you can ssh to the other box and type something like

tell iTunes to playpause