File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes interactive Java? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "interactive Java?" Watch "interactive Java?" New topic

interactive Java?

M Beck
Ranch Hand

Joined: Jan 14, 2005
Posts: 323
does anybody know of an interactive Java environment, down the lines of old Lisp environments or scripting languages like Perl or Python? something where i could type Java expressions and statements into a command line, and have them byte-compiled and evaluated immediately? it'd help my coding a lot.
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
Java is a compiled language, not an interpreted one.
Therefore you can't have an interactive environment.

You might be able to create a Java interpreter, but creating one that causes code to behave in the exact same way as compiled code would be extremely difficult.

Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

The "BeanShell" package does a pretty good job of this; it's incorporated in a number of different other tools. See .

[Jess in Action][AskingGoodQuestions]
M Beck
Ranch Hand

Joined: Jan 14, 2005
Posts: 323
BeanShell does indeed look like it'll do the job. not quite as close to the compiled language as i might like, but close enough. thanks!
Ilja Preuss

Joined: Jul 11, 2001
Posts: 14112
Take a look at

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
M Beck
Ranch Hand

Joined: Jan 14, 2005
Posts: 323
DrJava's "interaction pane" seems to work even better than BeanShell for me. it's a larger download, since DrJava is a fairly complete IDE with a lot of bells and whistles beside just the interactive evaluation prompt, but it's still reasonably small, and the language interpreted at that command line seems to be a bit closer to "proper" Java than what BeanShell implements. after evaluation, i suspect i'll end up sticking with DrJava. thanks everyone!
I agree. Here's the link:
subject: interactive Java?
It's not a secret anymore!