tags:

views:

193

answers:

4

I'd like to use the Bean Scripting Framework to make some of my Java classes be available to users at my company who wish to write scripts + who may be familiar with Javascript or Python (via Jython) or Ruby (via JRuby).

I can't really find much tutorial documentation on how to get BSF working... what I would like to do is make a Java app that runs a shell, either in Javascript or Jython or JRuby, and exposes some Java classes of mine to the scripting language.

Any pointers? I've glanced through some of the docs at the BSF Resources page but I have a feeling I'm missing something obvious to get started.

(like there must be some shell already out there, complete w/ a rudimentary debugger...)

edit: To clarify -- I know how to run bsf.jar, it works fine. And I know how to run the Javascript shell with Rhino -- but that's specific to Javascript and has nothing to do with BSF. My question is, is there a language-agnostic shell that works with BSF?

+1  A: 

To use BSF you need bsf.jar and the library for your scripting language of choice on the classpath. To execute Javascript, no additional libraries are required.

To open an interactive Javascript console try:

java org.mozilla.javascript.tools.shell.Main
cuberoot
I've clarified in my question -- you answered the two halves of my question that I already know how to do, but I need to do them together.
Jason S
A: 

I don't know any language agnostic shell. You could try jline + javax.script + $language to write it yourself. Hope it helps :)

dfa
+1  A: 

Why do you need BSF?

Any JVM language can access Java classes directly. JRuby's way, Jython's. And any JVM language will have support for debugging somehow (an example here).

Marcelo Morales
+1  A: 

Check out dynamic JVM programming languages like Groovy or JRuby! You can use your java classes without any modification.

Martin K.