MCPcopy Index your code
hub / github.com/beanshell/beanshell

github.com/beanshell/beanshell @2.1.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release 2.1.1 ↗ · + Follow
2,189 symbols 6,680 edges 201 files 624 documented · 29%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

BeanShell

Moved from apache-extras.org

On 2015-09-23, the BeanShell repository moved from https://code.google.com/a/apache-extras.org/p/beanshell/ to its new home on https://github.com/beanshell/beanshell/ as Google Code has been discontinued.

BeanShell had previously moved to Apache Extras from http://beanshell.org/, which remains available for older versions.

Introduction

BeanShell is a small, free, embeddable Java source interpreter with object scripting language features, written in Java. BeanShell dynamically executes standard Java syntax and extends it with common scripting conveniences such as loose types, commands, and method closures like those in Perl and JavaScript.

You can use BeanShell interactively for Java experimentation and debugging as well as to extend your applications in new ways. Scripting Java lends itself to a wide variety of applications including rapid prototyping, user scripting extension, rules engines, configuration, testing, dynamic deployment, embedded systems, and even Java education.

BeanShell is small and embeddable, so you can call BeanShell from your Java applications to execute Java code dynamically at run-time or to provide extensibility in your applications. Alternatively, you can use standalone BeanShell scripts to manipulate Java applications; working with Java objects and APIs dynamically. Since BeanShell is written in Java and runs in the same VM as your application, you can freely pass references to "live" objects into scripts and return them as results.

License

BeanShell is licensed under the Apache License, version 2.0. See LICENSE for details, and the NOTICE file for required attributions.

Earlier versions of BeanShell (2.0b4 and earlier) were distributed under GNU Lesser General Public License (LGPL) and Sun Public License (SPL).

Download

Source code

The source code releases can be downloaded from Bintray or GitHub....

Latest source code:

Maven

Beanshell releases are published to Maven Central. To use Beanshell with Maven, add to to your pom.xml:

    <dependencies>
       <dependency>
         <groupId>org.apache-extras.beanshell</groupId>
         <artifactId>bsh</artifactId>
         <version>2.0b6</version>
       </dependency>
    </dependencies>

JAR binary

You can also download the bsh.jar binary from Bintray.

To execute the Beanshell user interface, either double-click the JAR file, or run it with:

java -jar bsh-2.0b6.jar

You will need Java 5 or later installed.

Contribute

You are encouraged to raise a Github Pull Request with any suggested improvements and fixes!

You can also raise an issue for any questions or bugs. Remember, your stacktrace might be particularly useful for others!

Documentation

For full documentation, see the BeanShell user manual and the FAQ for frequently asked questions.

Summary of features

  • Dynamic execution of the full Java syntax, Java code fragments, as well as loosely typed Java and additional scripting conveniences.
  • Transparent access to all Java objects and APIs.
  • Runs in four modes: Command Line, Console, Applet, Remote Session Server.
  • Can work in security constrained environments without a classloader or bytecode generation for most features.
  • The interpreter is small ~150K jar file.
  • Pure Java.
  • It's Free!!

Java evaluation features

  • Evaluate full Java source classes dynamically as well as isolated Java methods, statements, and expressions.

Scripting features

  • Optionally typed variables.
  • Scripted methods with optionally typed arguments and return values
  • Scripted objects (method closures)
  • Scripted interfaces and event handlers.
  • Convenience syntax for working with JavaBean? properties, hashtables, and primitive wrapper types.
  • Auto-allocation of variables to emulate Java properties files.
  • Extensible set of utility and shell-like commands
  • Dynamic classpath management including find grained class reloading
  • Dynamic command loading and user command path
  • Sophisticated namespace and callstack management
  • Detailed error reporting

BeanShell Uses

  • Interactive Java - try out object features, APIs and GUI widgets - "hands on".
  • Scripting extension for applications - Allow your applications to be extended via scripts in an intuitive and simple way.
  • Macro Languages - Generate scripts as macros and execute them live in your VM easily.
  • Education - Teach Java in a hands-on, live environment
  • Expression evaluator for scientific, financial apps and rules engines - evaluate complex expressions with conditions and loops.
  • Remote debugging - Embed a live, remotely accessible shell / command line in your application with just a few lines of code.
  • Use BeanShell declaratively to replace properties files and replace startup config files with real scripts that perform complex initialization and setup with the full Java syntax at their disposal.

Extension points exported contracts — how you extend this code

ConsoleInterface (Interface)
The capabilities of a minimal console for BeanShell. Stream I/O and optimized print for output. A simple console may [5 …
src/bsh/ConsoleInterface.java
Bindings (Interface)
A mapping of key/value pairs, all of whose keys are Strings . @version 1.0 @author Mike Grogan @since 1.6 [3 implementers]
engine/javax-src/javax/script/Bindings.java
TestFilter (Interface)
(no doc) [4 implementers]
tests/junitTests/src/bsh/TestFilter.java
C (Interface)
(no doc) [4 implementers]
tests/src/InheritanceTest/C.java
ParserConstants (Interface)
(no doc) [13 implementers]
src/bsh/ParserConstants.java
ScriptContext (Interface)
The interface whose implementing classes are used to connect Script Engines with objects, such as scoped Bindings, in ho [2 …
engine/javax-src/javax/script/ScriptContext.java
Public (Interface)
(no doc) [2 implementers]
tests/junitTests/src/bsh/Issue_88_Test.java
Interface (Interface)
(no doc) [2 implementers]
tests/src/Interface.java

Core symbols most depended-on inside this repo

jj_consume_token
called by 268
src/bsh/Parser.java
jj_scan_token
called by 242
src/bsh/Parser.java
println
called by 128
src/bsh/ConsoleInterface.java
equals
called by 115
src/bsh/BshMethod.java
get
called by 113
engine/javax-src/javax/script/ScriptEngine.java
append
called by 112
src/bsh/util/JConsole.java
closeNodeScope
called by 110
src/bsh/JJTParserState.java
jjtreeCloseNodeScope
called by 110
src/bsh/Parser.java

Shape

Method 1,946
Class 210
Interface 32
Enum 1

Languages

Java100%

Modules by API surface

src/bsh/Parser.java368 symbols
src/bsh/JThis.java86 symbols
src/bsh/classpath/BshClassPath.java71 symbols
src/bsh/NameSpace.java66 symbols
src/bsh/Interpreter.java51 symbols
src/bsh/util/JConsole.java49 symbols
src/bsh/ParserTokenManager.java48 symbols
src/bsh/Reflect.java45 symbols
src/bsh/BshClassManager.java41 symbols
src/bsh/Primitive.java39 symbols
src/bsh/ClassGeneratorUtil.java36 symbols
src/bsh/util/ClassBrowser.java32 symbols

For agents

$ claude mcp add beanshell \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact