On Mon, 3 Jun 2002, [EMAIL PROTECTED] wrote:

> The JDE uses Java primarily for tasks that require introspection,
> e.g., determining all the methods, fields, and ancestors of a
> class. Using Java for this purpose requires some scheme for
> interfacing the JDEE to a virtual machine.
> 
> The approach that the JDE uses is based on the BeanShell. As you may
> know, the BeanShell is an interpreter that executes Java
> statements. 

Your reply made me go play with beanshell a bit.  Very, very slick.  I
showed it around the office and now three of the java developers at the
company I'm contracting for are using it to do quick testing.

All I did was show the button example from the website and then changed
the text of the button with, button.setText("Galen"); and they
immediately downloaded it and put it in their classpath.  Now, all I
need to do is get them to use the JDEE.  Hey, the company is in Kendall
Square, want to make a field trip out and put on a JDEE show?  :-)


> The JDE includes a command-line interface to the BeanShell that allows
> a user to start and terminate a BeanShell session and interact with
> the BeanShell in an Emacs buffer. The JDEE passes Java statements
> entered in the buffer to the BeanShell via interprocess I/O for
> evaluation and displays the result in the buffer.
> 
> The JDEE also includes a function, jde-jeval-r, that allows a Lisp
> program to use the same interface to send Java statements to the
> BeanShell for evaluation.  jde-jeval-r assumes that the result of
> evaluating the Java statement is a Lisp expression and evaluates
> the Lisp expression. The idea here is that the JDEE speaks to Java
> (via the BeanShell) in Java and Java speaks back (via standard out on
> the BeanShell process) in Elisp. This, of course, assumes that the
> Java side of the dialogue has been written specifically to communicate
> with the Elisp side.
> 
> For example, here is a complete implementation for an "Echo wizard" in
> which the Java side echod a string sent to it by the Elisp side in the
> Emacs minibuffer, using the Elisp "message" function.
> 
> 
> // Java file EchoWizard.java
> // compile this file and make sure that it
> // in jde-global-classpath (the BeanShell always
> // starts with jde-global-classpath
> package jde.wizard;
> public class EchoWizard {
> 
>   public static void echo(String msg) {
>     System.out.println("(message \"" + msg + "\")");
>   }      
> 
>}
> 
> ;; echo-wizard.el
> (require 'jde)
> (jde-jeval-r "jde.wizard.EchoWizard.echo(\"sleepy hollow\");")

This is elegantly simple.

> You can find numerous instances of this "design pattern" in
> the JDE Elisp source code by searching for jde-jeval-r. The
> Java side of the dialog initiated by the Lisp code resides
> in the java subdirectory of the JDE directory.

I will be perusing your code as I go.  Now, I'll know the line where
elisp ends and java begins.

> I hope this is clear. If not, I'd be happy to answer any further
> questions you have.

It is quite clear.  Thanks for the tutorial.  It was exactly what I
needed.

-- 
Galen deForest Boyer
Sweet dreams and flying machines in pieces on the ground.

Reply via email to