4

Possible Duplicate:
Java REPL shell

Is there a project that makes a command prompt that can execute Java statements? Why not? I'm looking for something like the builtin shell of Python but for Java.

I see there is http://www.beanshell.org/ but that project does not seem very active. But it appears to be what I'm looking for. Are there any other projects like this?

I want to be able to do something like this

$ import org.foobar.Bletch

$ new Bletch();

or similar. Has anyone done this?

Community
  • 1
  • 1
Niklas Rosencrantz
  • 25,640
  • 75
  • 229
  • 424
  • 1
    Without any offense, could you tell what you do you find in a java shell? – zeller Aug 22 '12 at 13:08
  • 1
    How about [jython](http://www.jython.org/)? While this is actually a python shell built on top of java, you would be able to access all java features with it. So practically it's a java shell with python syntax and additional python features... – l4mpi Aug 22 '12 at 13:08

3 Answers3

4

You could always use a Clojure REPL - I do this for dynamically playing with Java objects at runtime.

(import 'my.package.SomeClass)

(def a (new SomeClass))

(.methodName a arg1 arg2)

Works pretty well as long as you know the Clojure syntax.

mikera
  • 105,238
  • 25
  • 256
  • 415
3

Look at Groovy Shell - this is not exactly Java, but very close.

Alexei Kaigorodov
  • 13,189
  • 1
  • 21
  • 38
1

You can use http://www.beanshell.org/

It is more than 12 years old and is used in a number of IDE's debuggers.

Peter Lawrey
  • 525,659
  • 79
  • 751
  • 1,130