aspose file tools*
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
Author

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.


42
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24184
    
  34

The "BeanShell" package does a pretty good job of this; it's incorporated in a number of different other tools. See http://www.beanshell.org/ .


[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
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Take a look at http://drjava.sourceforge.net/


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!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: interactive Java?