Frank C.
Frank C.

Reputation: 8098

How to load java AppleScript engine dynamically from Clojure?

Later versions of Java (7, 8) do not include Apples AppleScript script engine and it is required to modify a java projects META-INF services.

So, two questions:

  1. How would I do this from Clojure code in a REPL
  2. How would I set this once (statically) so it is automatic anytime I start a project namespace in a REPL

Upvotes: 0

Views: 193

Answers (1)

tnoda
tnoda

Reputation: 1524

Oracle JDK 8 for Mac OS X still comes with an AppleScript engine and you can use it dynamically from Clojure without configuring META-INF/services. The following example demonstrates a say-hello script.

user> (import 'apple.applescript.AppleScriptEngineFactory)
apple.applescript.AppleScriptEngineFactory

user> (let [engine (.getScriptEngine (AppleScriptEngineFactory.))]
        (.eval engine "say \"hello\""))
nil

Upvotes: 1

Related Questions