ADC Home > Reference Library > Technical Q&As > Legacy Documents > Java >
Important: This document is part of the Legacy section of the ADC Reference Library. This information should not be used for new development.
Current information on this Reference Library topic can be found here:
Q: How do I run a command-line Java application from AppleScript without getting a timeout? Since I have no interface components, the supplied MRJ
So I put the command-line parameters into JBindery and tell the JBound application to run. The JBound "MyParser" application runs fine and quits, but nothing is returned to the calling AppleScript. As a result, the event times out. How do I make this work correctly?
A: The MRJ scripting model is very similar to scripting an ordinary scriptable Mac application. You have a scriptable application running and you send scripting commands to it. Typically, you would make a JBound application, launch it, and script it by addressing one of its AWT-based windows.
If you are working with a command-line-based Java application that doesn't create any AWT windows, then your application is not following the typical MRJ scripting model. To script your application, you will need to follow a few extra steps in order to be able to use scripting.
First, you need a Java shell application that is running to send scripting commands. You can write a trivial application that
has an empty
The next requirement is to ensure that the jar file that contains
Now you can invoke main:
But you still will not get any result since your class is declared to return void:
If you want to get the output of the console window, you can do the following:
[Apr 27 1999]