Java As An Interpreted Language

Write some scripting glue so that every time you want to "run" a Java source file it gets compiled to a temporary directory. Make sure you're using the JikesCompiler so that process is fast. Throw the class files away when you're done. Then you can say things like:

%> run TradingServer.java

And off it goes... No more worrying about those pesky class files.

How's that different from BeanShell?

BeanShell is a Java interpreter written in Java. Any code you run in it is one more level removed from the JavaVirtualMachine.


How much would you like to wager that productivity increases substantially using this system due to a faster feedback loop? Working in any good language aware editor should feel like this (VisualAgeJava, for example)


The Scrapbook feature in VisualAgeJava and EclipseIde already does that and more. Just type in segments of Java code you want, like

   System.out.println("answer=" + (3+4));

and just run it. No class, no main, you can't get simpler than that. Only downside is you have to put in the full package name of any class you use, other than those in java.lang.

In VisualAge, there is a menu command that allows you to specify a package name for the code to run in.


Smalltalk, which is the underlying engine in VisualAgeJava, does something very different from the original TrollBait?. In a Smalltalk environment (like the Lisp environments that were its ancestors), virtually any pane that contains editable text allows any selection to be compiled and edited from within Smalltalk. This means that the behavior of the interpreter itself -- including, for example, the language being interpreted -- is completely accessible from the code being executed.

Scripting glue, file systems, compilers -- all become unnecessary distractions from the developer's task of getting a particular piece of code running.

Yes, the fact that you have to jump through all these hoops to get even close to that in Java is pretty sad. As is the fact that its not even that close :(


What about InstantJ?

InstantJ ( http://instantj.sourceforge.net/ ) is a library you can use to compile and execute Java code or evaluate expressions written in Java. This is done on the fly - there is no pre-compiling step necessary. This is ideal in cases where expressions are either assembled programmatically at runtime, are read from descriptors or received from user-input.


CategoryJava


EditText of this page (last edited February 3, 2003) or FindPage with title or text search