prerelease version of 1998.12.2JevaES accepts Java 1.1 source code expressions and statements (but not class declarations) and evaluates (interprets) them. JevaES uses the reflective capabilities included in Java 1.1 (java.lang.reflect) so it can be useful for exploring with and/or debugging an existing compiled system (in case your development environment doesn't provide this capability). The reflection API restricts access to public fields and methods, so it may not be able to access everything a debugging evaluator can.
Copyright (c) 1997, 1998 Massachusetts Institute of Technology.
This software is provided "as is" without express or implied warranty.
Contains parser generated by Sun's JavaCC/JJTree from a modified version of the example Java grammar.
JevaESUI is a user interface to JevaES. JevaESUI's window contains a scrolling pane of results and a field to type or paste in new expression or statements. A button starts evaluating the field as a Java expression (another just parses the expression); similar buttons do the same for Java statements.
The results can be examined using a Java Examiner, Jexa, which uses the Java 1.1 reflection capabilities and the JavaBeans introspector to access the public fields and properties of objects and display them in an outline tree for browsing. Objects found through navigation can be used to set the value of Jexa.mousedObject, so that they are accessible for use in method calls.
Applet: If you're viewing this page in a fully Java 1.1 capable
browser such as
Communicator
4.06, IE
4.01, or HotJava,
pressing the button applet below should start up JevaESUI's window. If
your browser does not support Java 1.1, loading the applet will cause an
error and no button will appear. (It may take a few minutes to load the
files over the network and start the applet.) [On MIT Athena Suns,
add
javadev, then hotjava.] You can also point the Sun's JDK
appletviewer at the URL of this page to run the applet button
(appletviewer http://www.ai.mit.edu/people/caroma/tools/JevaESUI.html);
appletviewer won't display this surrounding text.
Type or paste expressions or statements in the lower pane; results will appear in the upper pane. Variables declared at top level (not inside a { } block) extend the environment used for evaluating later expressions and statements. You can try complex (or ridiculous) parses like "~1*2+3^4%5|6&7>>>8" and examine the resulting parse tree to see if you understand the precedence order. You can Print to the result pane with:
import edu.mit.ai.psg.jevaESUI.JevaESUI;
JevaESUI.out.println("Hello.");
(If used in an application rather than from an applet's security box, JevaESUI
redirects System.out to the result pane as well.) Previous results are
in: JevaESUI.results.elementAt(n)
Use from programs: To use JevaESUI for your own Java1.1 experiments (e.g., loaded along with your own programs so you can experiment with them directly without compiling), download the Jar files at the end of this page and list them in your classpath. (JevaES requires Java 1.1.) At a point in your program where you want to experiment you can just import edu.mit.ai.psg.jevaESUI.JevaESUI and then call it:
JevaESUI.main(null);Alternatively, you can add insepection points into your program, where you can experiment with values of program variables using a read-eval-print-loop (REPL) window as shown in the brief example below. (To run example, copy text below and save it to DemoJevaESUIInspectPoint.java, then compile and run.)
// DemoInspectPoint.java
import java.awt.*;
import edu.mit.ai.psg.jevaESUI.JevaESUI;
import edu.mit.ai.psg.jevaES.JevaES;
public class DemoInspectPoint {
public static void main(String[] args) {
Frame frame = new java.awt.Frame("DemoInspectPoint Frame");
frame.add(new Label("Resize Me, then try frame.getSize()"));
frame.setSize(500, 100);
Dimension dim = frame.getSize();
frame.show();
JevaESUI.replWindow // inspectPoint
(true, false, true,
("InspectPoint: \n"+
" frame: "+frame+"\n"+
" dim: "+dim+"\n"),
JevaES.extendEnv
(Frame.class, "frame", frame,
JevaES.extendEnv
(Dimension.class, "dim", dim,
JevaES.makeDefaultEnv())));
}
}
Jar files: The current jar files can be downloaded here:
Platform Notes: Using Netscape Communicator 4.06 enhances security which prevents the Java bean Introspector from doing its analysis, so when called from an applet in Communicator 4.06, Jexa will only display public fields of objects. Note that for some versions of Communicator, "Save Link As" may not download jar files correctly from the via http link, so try the via ftp link instead.
Prior version of this page with prior platform notes and prior versons of software is available here.
Bugs to jeva-bugs@ai.mit.edu
This page describes research done at the Artificial Intelligence Laboratory of the Massachusetts Institute of Technology. Support for this research was provided in part by the Advanced Research Projects Agency of the Department of Defense under contracts MDA972-95-1-0018 (North East Regional Consortium Grant) and N66001-95-C-8611 (Computer Aided Education and Training Initiative), and the MIT Department of Electrical Engineering and Computer Science. Support for this research has also been received from IBM, which has generously donated Thinkpad pen computers, and from Microsoft, which has generously donated software.