Bean Scripting Structure

I would like to use the Bean Scripting Framework so that some of my Java classes are accessible to users of my company who want to write + scripts that may be familiar with Javascript or Python (through Jython) or Ruby (through JRuby).

I cannot find many tutorials on how to make BSF work ... what I would like to do is a Java application that launches a shell, either in Javascript, or in Jython, or in JRuby, and provides some classes Java from my scripting language.

Any pointers? I looked through some documents on the BSF Resources page , but I have the feeling that I am missing something obvious to begin with.

(like there should be some kind of shell already there, a full w / rudimentary debugger ...)

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

+3
source share
4 answers

To use BSF, you will need bsf.jar and a library for your chosen scripting language in the classpath. No additional libraries are required to run Javascript.

To open the interactive Javascript console, follow these steps:

java org.mozilla.javascript.tools.shell.Main
+2
source

Why do you need BSF?

JVM Java-. JRuby, Jython. JVM - ( ).

+1

JVM, Groovy JRuby! java - .

+1

- . jline + javax.script + $, . , :)

0

Source: https://habr.com/ru/post/1704084/


All Articles