| CARVIEW |
|
jasconn
|
| Summary | A small wrapper to access AppleScript using JSR-223 |
|---|---|
| Categories | None |
| License | GNU General Public License (GPL) |
| Owner(s) | tommi_kuenneth |
Welcome to Java-AppleScript-Connector
AppleScript is a powerful scripting language, which is very popular among Mac users. Scripts consist of small English sentences, for example tell application "Finder" to open the trash. Mac OS X ships with lots of interesting examples which show how to use AppleScript. Of course, the Internet offers a wealth of freely available scripts, too.
Java Standard Edition 6 allows the tight integration of Java and scripting languages through a standard Java Scripting API, which is specified in JSR-223: Scripting for the Java Platform. My article Scripting for the Java Platform offers an in-depth look at how Java developers can make use of this API.
Currently, Java SE 6.0 Betas ship with one pre-installed scripting language, the Mozilla Rhino implementation of JavaScript. Independent developers provide implementations of some other scripting languages. So far there is no JSR-223 compliant implementation of AppleScript. Java-AppleScript-Connector aims to fill this gap. It provides a wrapper which acts as a bridge between Java and AppleScript. Java-AppleScript-Connector is not a re-implementation of AppleScript. Therefor it will only work on Mac OS X. In addition please note that Java-AppleScript-Connector requires Java SE 6.0. You can obtain a preview from the Apple Developer Connection.
My article Making Scripting Languages JSR-223-Aware offers some insights on how to make existing scripting languages ready for the new Java Scripting API and is based on my work on jasconn.
Getting started
At the moment, you have to check out the sources and build Java-AppleScript-Connector on your own. As jasconn makes use of classes supplied by Apple you first need to add them to your classpath. So, right-click on the project root in NetBeans and choose Properties. Select Libraries and click the Add Library button. You will notice the Add Library dialog box. Choose Manage Libraries. In the Library Manager click on New Library. Now, please specify a library name, for example AppleClasses and choose Class Libraries as the library type. You are almost finished now. Click on Add JAR/Folder and select /System/Library/Java. Make sure your new library is listed in the Libraries section. I plan to have binary releases in the futture when the project is a little bit more stable. They will contain only Java-AppleScriptConnector.jar.
To use jasconn you just have to copy Java-AppleScript-Connector.jar (whether you built it on your own or you downloaded it) to /Library/Java/Extensions or add it to the Libraries section of your projects. . The new scripting engine will then be detected automatically by JSR-223 compliant Java programs. The jar contains a demo which you can run as follows: java -jar Java-AppleScript-Connector.jar.
Important notice: At the moment Java-AppleScript-Connector is far from being a finished product. It is in its infancy instead. For example some optional classes, interfaces and methods have not yet been implemented. Additionally, please expect to find bugs. Do not hesitate to contact me, I will try to fix them. Still, I may not be held responsible for any damage caused by the use of this class library. Please refer to the GNU general public licence version 2 for more legal details.
| Powered by CollabNet | Feedback |
FAQ |
Press |
Developer tools
© 1995 - 2007 CollabNet. CollabNet is a registered trademark of CollabNet, Inc. |
