||Controlling Your Mac with AppleScript and Java|
|Subject:||How to do AppleScript in Pure Java|
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