Reverse of importCommands and importCommands problem

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Reverse of importCommands and importCommands problem

levent bayindir

I recently started to create a Matlab like environment using BeanShell.

There will be a commands directory which will contain libraries. You can think of libraries as Matlab toolboxes. The libraries will contain commands inside .bsh files.

I integrated BeanShell console inside a JFrame and working with that console.

First of all, i loaded standard library inside my JFrame code using the Interpreter object of BeanShell console. The following commands do this:


My initial aim is to load/unload libraries interactively using loadLibrary(..) and unloadLibrary(..) commands. (These commands will be in standard library loaded automatically!)

The implementation of loadLibrary(..) is as follows :

loadLibrary(String libraryName) {
    print("Library "+ libraryName + " is loaded.");


deneme function is defined in deneme.bsh under web directory. It has the following defintion just for testing:

deneme() {



The deneme call inside loadLibrary function is working but when i returned to the JConsole and call deneme function explicitly by writing "deneme(); "; it gives the following error:

// Error: EvalError: Command not found: deneme() : at Line: 1 : in file: <unknown file> : deneme ( )

I think this error means that the "web" library commans are not included.

I tried several versions of importCommands like super.importCommands(..)

What is the problem in my loadLibrary command? How to implement it in in a correct way?

One more problem is how to implement unloadLibrary(), i did not see reverse command of importCommands. What is the best way to implement it?

For further clarification, here is my directory structure for commands:


Thanks for the answers..

Beanshell-users mailing list
[hidden email]