[E-Lang] invoking E from Java plugins
Mark S. Miller
markm@caplet.com
Fri, 10 Aug 2001 22:11:26 -0700
At 09:28 AM Thursday 8/9/01, Nathan Combs wrote:
>Hi - I'm looking at invoking E from Java plugins -
Hi Nathan,
I don't know anything about "Java plugins" specifically, but I think the
rest of your question has enough information for me to try answering it. If
I'm misunderstanding you, please let me know.
>does there exist an
>interface to interpret a script programmatically from Java, eg. via text
>stream etc.
Yes. Explained below.
>i started down the path at looking at example mentioned in tutorial:
>
>java -jar e.jar textfilename
>
>however, noted that in the 0.8.9.1b e.jar the jar file is not properly
>set-up for this usage: JAR file must contain a line of the form Main-Class:
>classname
>
>any suggestions?
Exactly right. Since the website is the focus of discussions about E and
its evolution, it ideally tracks the current tip of the development tree --
reflecting the latest thinking about what the language is or should be. Of
course, parts go stale over time as well, so the web site is not currently
consistent with any one version. The next major release of E will be
0.8.10, which is the integration of 1) the modern version of the language (as
currently represented by the internal 0.8.9t) with 2) support for secure
distributed capability/object programming (as currently represented by the
last public release, 0.8.9.1b). My current maintenance on the web site is
attempting to bring it into consistency with 0.8.10.
The line above,
java -jar e.jar textfilename
applies to 0.8.9t on, but does not apply to 0.8.9.1b. Instead, let's say
your install directory is "/E Install". You should then use
java -cp "/E Install/bin/jars/e.jar" "-De.home=/E Install" org.erights.e.elang.interp.Interp textfilename
(In case it was wrapped, the above should of course appear on one line.)
To run E scripts programmatically from Java programs, the starting point is
the static "make" method of org.erights.e.elang.interp.Interp class. Since
the javadoc on the erights site reflects a different version of E, you
should look at the comments in the file or generate your own javadoc, and go
from there.
An issue to be aware of (and a kludge which will be cleaned up in 0.8.10):
If the optLineReader parameter is null, then the first elements of the
'args' list will be interpreted as the name of the file to interpret. If
you wish to feed it source text yourself, but not by creating a LineReader,
you still need to pass it a non-null LineReader to suppress that special
treatment of args. You can then feed it text with setSource(). The
org.erights.e.ui.elmer.EInterpAdapter uses this technique.
Please let me know what else you need in order to get E working in your
configuration.
Sorry for the confusion. In the future, perhaps we'll provide for each
release a tarball of the web site as it existed at the time of that release.
Cheers,
--MarkM