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
  • 23,939
  • 70
  • 214
  • 404
  • 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
  • 103,535
  • 24
  • 250
  • 410
3

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

Alexei Kaigorodov
  • 12,853
  • 1
  • 19
  • 36
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
  • 513,304
  • 74
  • 731
  • 1,106