I am trying to run the following code, when the RunAppleScript method is launched it comes up with the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: com/apple/cocoa/foundation/NSAppleScript
at Copying.RunApplescript(Copying.java:141)
at Copying.main(Copying.java:161)
line 141 is 'NSAppleScript myScript =new NSAppleScript(script);'
What's the problem?
Exception in thread "main" java.lang.NoClassDefFoundError: com/apple/cocoa/foundation/NSAppleScript
at Copying.RunApplescript(Copying.java:141)
at Copying.main(Copying.java:161)
line 141 is 'NSAppleScript myScript =new NSAppleScript(script);'
Code:
import com.apple.cocoa.foundation.*;
import com.apple.cocoa.application.*;
public class test{
public static void RunApplescript(String script){
// This creates a new NSAppleScript
// object to execute the script
NSAppleScript myScript =new NSAppleScript(script);
// This dictionary holds any errors that are
// encountered during script execution
NSMutableDictionary errors =
new NSMutableDictionary();
// Execute the script!
NSAppleEventDescriptor results=myScript.execute(errors);
}
}